diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c121b450743b..f16ec6febee8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23139,24 +23139,27 @@ importers: sdk/postgresql/arm-postgresql-flexible: 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-client': - specifier: ^1.9.3 - version: link:../../core/core-client '@azure/core-lro': - specifier: ^2.5.4 - version: 2.7.2 - '@azure/core-paging': - specifier: ^1.6.2 - version: link:../../core/core-paging + specifier: ^3.1.0 + version: link:../../core/core-lro '@azure/core-rest-pipeline': - specifier: ^1.19.1 + 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 @@ -23173,12 +23176,12 @@ importers: '@azure/dev-tool': specifier: workspace:^ version: link:../../../common/tools/dev-tool + '@azure/eslint-plugin-azure-sdk': + specifier: workspace:^ + version: link:../../../common/tools/eslint-plugin-azure-sdk '@azure/identity': specifier: catalog:internal version: 4.13.0 - '@azure/logger': - specifier: workspace:^ - version: link:../../core/logger '@types/node': specifier: 'catalog:' version: 20.19.37 @@ -32680,156 +32683,24 @@ packages: '@epic-web/invariant@1.0.0': resolution: {integrity: sha1-EHPl3ubdVAQQeEmQ63PkrNJcmBM=} - '@esbuild/aix-ppc64@0.27.3': - resolution: {integrity: sha1-gVs5Jn+b/9NAfqbDdqwylG4k+NI=} - engines: {node: '>=18'} - cpu: [ppc64] - os: [aix] - - '@esbuild/android-arm64@0.27.3': - resolution: {integrity: sha1-GbiCQIgprY4SsQr/KEBxGy2jYeg=} - engines: {node: '>=18'} - cpu: [arm64] - os: [android] - - '@esbuild/android-arm@0.27.3': - resolution: {integrity: sha1-kL5Y3ieRXvont2f8vbN6RHBifXs=} - engines: {node: '>=18'} - cpu: [arm] - os: [android] - - '@esbuild/android-x64@0.27.3': - resolution: {integrity: sha1-19zJdvFuAamqovm5OPvsc4n4law=} - engines: {node: '>=18'} - cpu: [x64] - os: [android] - - '@esbuild/darwin-arm64@0.27.3': - resolution: {integrity: sha1-n2yscrOoUyKYpqRJPtY5qJiOir0=} - engines: {node: '>=18'} - cpu: [arm64] - os: [darwin] - '@esbuild/darwin-x64@0.27.3': resolution: {integrity: sha1-rGHWRfqjf9ZQNA8YZrCBLh+xTWo=} engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/freebsd-arm64@0.27.3': - resolution: {integrity: sha1-uGJWidc88YMP5Yw5BRrNwSR06hs=} - engines: {node: '>=18'} - cpu: [arm64] - os: [freebsd] - - '@esbuild/freebsd-x64@0.27.3': - resolution: {integrity: sha1-B75908nUL+DszSq5+d7XgLxTvq0=} - engines: {node: '>=18'} - cpu: [x64] - os: [freebsd] - - '@esbuild/linux-arm64@0.27.3': - resolution: {integrity: sha1-vzGRj+XHmFhkYNKz1sRu0sAcoLY=} - engines: {node: '>=18'} - cpu: [arm64] - os: [linux] - - '@esbuild/linux-arm@0.27.3': - resolution: {integrity: sha1-KEk+5Gq+wdw/UAIjzZ+NLfCPnRE=} - engines: {node: '>=18'} - cpu: [arm] - os: [linux] - - '@esbuild/linux-ia32@0.27.3': - resolution: {integrity: sha1-dQdSqLMLQ2R0AlYe6nZNCkHQ7ik=} - engines: {node: '>=18'} - cpu: [ia32] - os: [linux] - - '@esbuild/linux-loong64@0.27.3': - resolution: {integrity: sha1-pakoE6BOcRmMUPBa368Y/B6Vue0=} - engines: {node: '>=18'} - cpu: [loong64] - os: [linux] - - '@esbuild/linux-mips64el@0.27.3': - resolution: {integrity: sha1-3rRdf9LSFh6t8fvFk2N+12bVC7E=} - engines: {node: '>=18'} - cpu: [mips64el] - os: [linux] - - '@esbuild/linux-ppc64@0.27.3': - resolution: {integrity: sha1-bzmuC4xNPS1hplsm33n24SocPXg=} - engines: {node: '>=18'} - cpu: [ppc64] - os: [linux] - - '@esbuild/linux-riscv64@0.27.3': - resolution: {integrity: sha1-TFwZw5FmEuyOORUYcDC53wuVXB0=} - engines: {node: '>=18'} - cpu: [riscv64] - os: [linux] - - '@esbuild/linux-s390x@0.27.3': - resolution: {integrity: sha1-ntF7MZj6CK1cyqnnT2wK/3rQFW0=} - engines: {node: '>=18'} - cpu: [s390x] - os: [linux] - '@esbuild/linux-x64@0.27.3': resolution: {integrity: sha1-Ejg9y/cbfPZRPli0sI2VpxC/UqU=} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/netbsd-arm64@0.27.3': - resolution: {integrity: sha1-3Qyy+lQyBfzZMd9E9Hhr/M5t99c=} - engines: {node: '>=18'} - cpu: [arm64] - os: [netbsd] - - '@esbuild/netbsd-x64@0.27.3': - resolution: {integrity: sha1-AorRgHqOA+FVFTstAltQbDeHNUs=} - engines: {node: '>=18'} - cpu: [x64] - os: [netbsd] - - '@esbuild/openbsd-arm64@0.27.3': - resolution: {integrity: sha1-48Fv80kMm1m5af/8qH81D/wOKvU=} - engines: {node: '>=18'} - cpu: [arm64] - os: [openbsd] - - '@esbuild/openbsd-x64@0.27.3': - resolution: {integrity: sha1-xaRpP8sD0cvsv4tCJCJGjfwNKos=} - engines: {node: '>=18'} - cpu: [x64] - os: [openbsd] - - '@esbuild/openharmony-arm64@0.27.3': - resolution: {integrity: sha1-CCCCRE8S21ZKB3WkHhmRwOElBV4=} - engines: {node: '>=18'} - cpu: [arm64] - os: [openharmony] - - '@esbuild/sunos-x64@0.27.3': - resolution: {integrity: sha1-WrA2xT+SnoQFxOluhlpCQWChtTc=} - engines: {node: '>=18'} - cpu: [x64] - os: [sunos] - '@esbuild/win32-arm64@0.27.3': resolution: {integrity: sha1-ON5wDvS5YKAEU3DBcXlFJuWJhi4=} engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-ia32@0.27.3': - resolution: {integrity: sha1-RRuT3APsXU84YZ5s1k2fnv8G9Vw=} - engines: {node: '>=18'} - cpu: [ia32] - os: [win32] - '@esbuild/win32-x64@0.27.3': resolution: {integrity: sha1-Dq9wXJQaIYpD26jgnx3x1s0vHxc=} engines: {node: '>=18'} @@ -33834,102 +33705,11 @@ packages: rollup: optional: true - '@rollup/rollup-android-arm-eabi@4.59.0': - resolution: {integrity: sha1-pnQsdMfZ1tYE74pI+ZMmtOzaPYI=} - cpu: [arm] - os: [android] - - '@rollup/rollup-android-arm64@4.59.0': - resolution: {integrity: sha1-lyR74JjeTfDBGXEIn9Lt+ApdqM8=} - cpu: [arm64] - os: [android] - - '@rollup/rollup-darwin-arm64@4.59.0': - resolution: {integrity: sha1-Z0hSzxTPEbgFbgsaL06HK1I1ds8=} - cpu: [arm64] - os: [darwin] - '@rollup/rollup-darwin-x64@4.59.0': resolution: {integrity: sha1-Nt/X7QqvTZ2J2e+YOvcmMkVbAkY=} cpu: [x64] os: [darwin] - '@rollup/rollup-freebsd-arm64@4.59.0': - resolution: {integrity: sha1-L4fCB0tCICYP21KpmWJG7fxjPCI=} - cpu: [arm64] - os: [freebsd] - - '@rollup/rollup-freebsd-x64@4.59.0': - resolution: {integrity: sha1-m1omUio4qV3AZhbRk51NmnaTeAM=} - cpu: [x64] - os: [freebsd] - - '@rollup/rollup-linux-arm-gnueabihf@4.59.0': - resolution: {integrity: sha1-hqpIWThahzQjW15ApI5S13B1jDo=} - cpu: [arm] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-arm-musleabihf@4.59.0': - resolution: {integrity: sha1-y+cOVubs6NrIPrdztiT8nlpGCXY=} - cpu: [arm] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-arm64-gnu@4.59.0': - resolution: {integrity: sha1-0UmSouZTvDJj0oS8ZXm3ookOHEU=} - cpu: [arm64] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-arm64-musl@4.59.0': - resolution: {integrity: sha1-L90d3ENOqQrqoIUdIER4m00H9to=} - cpu: [arm64] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-loong64-gnu@4.59.0': - resolution: {integrity: sha1-ihgeb4n5afIWZqdDzUEUFsgAmec=} - cpu: [loong64] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-loong64-musl@4.59.0': - resolution: {integrity: sha1-kEElryurw5X4Bh2qJ7WvH04/L3g=} - cpu: [loong64] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-ppc64-gnu@4.59.0': - resolution: {integrity: sha1-pXlwrGhkyaNEdBGmWCJL3PlIviI=} - cpu: [ppc64] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-ppc64-musl@4.59.0': - resolution: {integrity: sha1-u4TeWyaHBWekJnZm4IiR6Au1amM=} - cpu: [ppc64] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-riscv64-gnu@4.59.0': - resolution: {integrity: sha1-ctANLH+zdc41ZOdZ2zPxejW/+rk=} - cpu: [riscv64] - os: [linux] - libc: [glibc] - - '@rollup/rollup-linux-riscv64-musl@4.59.0': - resolution: {integrity: sha1-TBZu9Y5xj5JFvTGHM4S6FaXBqIM=} - cpu: [riscv64] - os: [linux] - libc: [musl] - - '@rollup/rollup-linux-s390x-gnu@4.59.0': - resolution: {integrity: sha1-u1AlzemmHbR4wspyFYCK07znOgk=} - cpu: [s390x] - os: [linux] - libc: [glibc] - '@rollup/rollup-linux-x64-gnu@4.59.0': resolution: {integrity: sha1-m2ax+c2VxmJMeI8CHHViaf/tFVI=} cpu: [x64] @@ -33942,26 +33722,11 @@ packages: os: [linux] libc: [musl] - '@rollup/rollup-openbsd-x64@4.59.0': - resolution: {integrity: sha1-6LNXstGqLI12qY9fDYieq+k/Tvk=} - cpu: [x64] - os: [openbsd] - - '@rollup/rollup-openharmony-arm64@4.59.0': - resolution: {integrity: sha1-lsLj9KrNPZIZgTKYMf+N3kkiBNw=} - cpu: [arm64] - os: [openharmony] - '@rollup/rollup-win32-arm64-msvc@4.59.0': resolution: {integrity: sha1-LYZRSdcG2Tjfi0uPEX5pp3ZG1YE=} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.59.0': - resolution: {integrity: sha1-q+FZO+D6kjJemXHI2kKcXgW5LDY=} - cpu: [ia32] - os: [win32] - '@rollup/rollup-win32-x64-gnu@4.59.0': resolution: {integrity: sha1-xK8+lRjJpc1LHBY9yB0K1Ngufqs=} cpu: [x64] @@ -36776,21 +36541,11 @@ packages: cpu: [x64] os: [darwin] - turbo-darwin-arm64@2.8.14: - resolution: {integrity: sha1-giI0aaKfWDHdunQ5wx3/Tg4xuws=} - cpu: [arm64] - os: [darwin] - turbo-linux-64@2.8.14: resolution: {integrity: sha1-mMOPqJiuj59pMlbAo6vohS5kuQc=} cpu: [x64] os: [linux] - turbo-linux-arm64@2.8.14: - resolution: {integrity: sha1-YEAsSeMfYD2QPH09mqkvvJgcqRU=} - cpu: [arm64] - os: [linux] - turbo-windows-64@2.8.14: resolution: {integrity: sha1-3POe9P/jB/5uRgqhJhzwHizztyM=} cpu: [x64] @@ -38158,81 +37913,15 @@ snapshots: '@epic-web/invariant@1.0.0': {} - '@esbuild/aix-ppc64@0.27.3': - optional: true - - '@esbuild/android-arm64@0.27.3': - optional: true - - '@esbuild/android-arm@0.27.3': - optional: true - - '@esbuild/android-x64@0.27.3': - optional: true - - '@esbuild/darwin-arm64@0.27.3': - optional: true - '@esbuild/darwin-x64@0.27.3': optional: true - '@esbuild/freebsd-arm64@0.27.3': - optional: true - - '@esbuild/freebsd-x64@0.27.3': - optional: true - - '@esbuild/linux-arm64@0.27.3': - optional: true - - '@esbuild/linux-arm@0.27.3': - optional: true - - '@esbuild/linux-ia32@0.27.3': - optional: true - - '@esbuild/linux-loong64@0.27.3': - optional: true - - '@esbuild/linux-mips64el@0.27.3': - optional: true - - '@esbuild/linux-ppc64@0.27.3': - optional: true - - '@esbuild/linux-riscv64@0.27.3': - optional: true - - '@esbuild/linux-s390x@0.27.3': - optional: true - '@esbuild/linux-x64@0.27.3': optional: true - '@esbuild/netbsd-arm64@0.27.3': - optional: true - - '@esbuild/netbsd-x64@0.27.3': - optional: true - - '@esbuild/openbsd-arm64@0.27.3': - optional: true - - '@esbuild/openbsd-x64@0.27.3': - optional: true - - '@esbuild/openharmony-arm64@0.27.3': - optional: true - - '@esbuild/sunos-x64@0.27.3': - optional: true - '@esbuild/win32-arm64@0.27.3': optional: true - '@esbuild/win32-ia32@0.27.3': - optional: true - '@esbuild/win32-x64@0.27.3': optional: true @@ -39379,75 +39068,18 @@ snapshots: optionalDependencies: rollup: 4.59.0 - '@rollup/rollup-android-arm-eabi@4.59.0': - optional: true - - '@rollup/rollup-android-arm64@4.59.0': - optional: true - - '@rollup/rollup-darwin-arm64@4.59.0': - optional: true - '@rollup/rollup-darwin-x64@4.59.0': optional: true - '@rollup/rollup-freebsd-arm64@4.59.0': - optional: true - - '@rollup/rollup-freebsd-x64@4.59.0': - optional: true - - '@rollup/rollup-linux-arm-gnueabihf@4.59.0': - optional: true - - '@rollup/rollup-linux-arm-musleabihf@4.59.0': - optional: true - - '@rollup/rollup-linux-arm64-gnu@4.59.0': - optional: true - - '@rollup/rollup-linux-arm64-musl@4.59.0': - optional: true - - '@rollup/rollup-linux-loong64-gnu@4.59.0': - optional: true - - '@rollup/rollup-linux-loong64-musl@4.59.0': - optional: true - - '@rollup/rollup-linux-ppc64-gnu@4.59.0': - optional: true - - '@rollup/rollup-linux-ppc64-musl@4.59.0': - optional: true - - '@rollup/rollup-linux-riscv64-gnu@4.59.0': - optional: true - - '@rollup/rollup-linux-riscv64-musl@4.59.0': - optional: true - - '@rollup/rollup-linux-s390x-gnu@4.59.0': - optional: true - '@rollup/rollup-linux-x64-gnu@4.59.0': optional: true '@rollup/rollup-linux-x64-musl@4.59.0': optional: true - '@rollup/rollup-openbsd-x64@4.59.0': - optional: true - - '@rollup/rollup-openharmony-arm64@4.59.0': - optional: true - '@rollup/rollup-win32-arm64-msvc@4.59.0': optional: true - '@rollup/rollup-win32-ia32-msvc@4.59.0': - optional: true - '@rollup/rollup-win32-x64-gnu@4.59.0': optional: true @@ -40585,31 +40217,9 @@ snapshots: esbuild@0.27.3: optionalDependencies: - '@esbuild/aix-ppc64': 0.27.3 - '@esbuild/android-arm': 0.27.3 - '@esbuild/android-arm64': 0.27.3 - '@esbuild/android-x64': 0.27.3 - '@esbuild/darwin-arm64': 0.27.3 '@esbuild/darwin-x64': 0.27.3 - '@esbuild/freebsd-arm64': 0.27.3 - '@esbuild/freebsd-x64': 0.27.3 - '@esbuild/linux-arm': 0.27.3 - '@esbuild/linux-arm64': 0.27.3 - '@esbuild/linux-ia32': 0.27.3 - '@esbuild/linux-loong64': 0.27.3 - '@esbuild/linux-mips64el': 0.27.3 - '@esbuild/linux-ppc64': 0.27.3 - '@esbuild/linux-riscv64': 0.27.3 - '@esbuild/linux-s390x': 0.27.3 '@esbuild/linux-x64': 0.27.3 - '@esbuild/netbsd-arm64': 0.27.3 - '@esbuild/netbsd-x64': 0.27.3 - '@esbuild/openbsd-arm64': 0.27.3 - '@esbuild/openbsd-x64': 0.27.3 - '@esbuild/openharmony-arm64': 0.27.3 - '@esbuild/sunos-x64': 0.27.3 '@esbuild/win32-arm64': 0.27.3 - '@esbuild/win32-ia32': 0.27.3 '@esbuild/win32-x64': 0.27.3 escalade@3.2.0: {} @@ -42188,29 +41798,10 @@ snapshots: dependencies: '@types/estree': 1.0.8 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.59.0 - '@rollup/rollup-android-arm64': 4.59.0 - '@rollup/rollup-darwin-arm64': 4.59.0 '@rollup/rollup-darwin-x64': 4.59.0 - '@rollup/rollup-freebsd-arm64': 4.59.0 - '@rollup/rollup-freebsd-x64': 4.59.0 - '@rollup/rollup-linux-arm-gnueabihf': 4.59.0 - '@rollup/rollup-linux-arm-musleabihf': 4.59.0 - '@rollup/rollup-linux-arm64-gnu': 4.59.0 - '@rollup/rollup-linux-arm64-musl': 4.59.0 - '@rollup/rollup-linux-loong64-gnu': 4.59.0 - '@rollup/rollup-linux-loong64-musl': 4.59.0 - '@rollup/rollup-linux-ppc64-gnu': 4.59.0 - '@rollup/rollup-linux-ppc64-musl': 4.59.0 - '@rollup/rollup-linux-riscv64-gnu': 4.59.0 - '@rollup/rollup-linux-riscv64-musl': 4.59.0 - '@rollup/rollup-linux-s390x-gnu': 4.59.0 '@rollup/rollup-linux-x64-gnu': 4.59.0 '@rollup/rollup-linux-x64-musl': 4.59.0 - '@rollup/rollup-openbsd-x64': 4.59.0 - '@rollup/rollup-openharmony-arm64': 4.59.0 '@rollup/rollup-win32-arm64-msvc': 4.59.0 - '@rollup/rollup-win32-ia32-msvc': 4.59.0 '@rollup/rollup-win32-x64-gnu': 4.59.0 '@rollup/rollup-win32-x64-msvc': 4.59.0 fsevents: 2.3.3 @@ -42589,15 +42180,9 @@ snapshots: turbo-darwin-64@2.8.14: optional: true - turbo-darwin-arm64@2.8.14: - optional: true - turbo-linux-64@2.8.14: optional: true - turbo-linux-arm64@2.8.14: - optional: true - turbo-windows-64@2.8.14: optional: true @@ -42607,9 +42192,7 @@ snapshots: turbo@2.8.14: optionalDependencies: turbo-darwin-64: 2.8.14 - turbo-darwin-arm64: 2.8.14 turbo-linux-64: 2.8.14 - turbo-linux-arm64: 2.8.14 turbo-windows-64: 2.8.14 turbo-windows-arm64: 2.8.14 diff --git a/sdk/postgresql/arm-postgresql-flexible/CHANGELOG.md b/sdk/postgresql/arm-postgresql-flexible/CHANGELOG.md index 385102aa1e03..a72749069413 100644 --- a/sdk/postgresql/arm-postgresql-flexible/CHANGELOG.md +++ b/sdk/postgresql/arm-postgresql-flexible/CHANGELOG.md @@ -1,5 +1,110 @@ # Release History +## 10.0.0-beta.1 (2026-03-12) +Compared with version 9.0.0 + +### Features Added + - Added operation AdministratorsMicrosoftEntraOperations.createOrUpdate + - Added operation AdministratorsMicrosoftEntraOperations.delete + - Added operation BackupsAutomaticAndOnDemandOperations.create + - Added operation BackupsAutomaticAndOnDemandOperations.delete + - Added operation BackupsLongTermRetentionOperations.start + - Added operation ConfigurationsOperations.put + - Added operation ConfigurationsOperations.update + - Added operation DatabasesOperations.create + - Added operation DatabasesOperations.delete + - Added operation FirewallRulesOperations.createOrUpdate + - Added operation FirewallRulesOperations.delete + - Added operation PrivateEndpointConnectionsOperations.delete + - Added operation PrivateEndpointConnectionsOperations.update + - Added operation ServersOperations.beginMigrateNetworkMode + - Added operation ServersOperations.beginMigrateNetworkModeAndWait + - Added operation ServersOperations.createOrUpdate + - Added operation ServersOperations.delete + - Added operation ServersOperations.migrateNetworkMode + - Added operation ServersOperations.restart + - Added operation ServersOperations.start + - Added operation ServersOperations.stop + - Added operation ServersOperations.update + - Added operation ServerThreatProtectionSettingsOperations.createOrUpdate + - Added operation VirtualEndpointsOperations.create + - Added operation VirtualEndpointsOperations.delete + - Added operation VirtualEndpointsOperations.update + - Added Interface AdministratorMicrosoftEntraProperties + - Added Interface AdministratorMicrosoftEntraPropertiesForAdd + - Added Interface AdvancedThreatProtectionSettingsProperties + - Added Interface BackupAutomaticAndOnDemandProperties + - Added Interface BackupsLongTermRetentionResponseProperties + - Added Interface CapturedLogProperties + - Added Interface ConfigurationProperties + - Added Interface DatabaseProperties + - Added Interface FirewallRuleProperties + - Added Interface LogSpecification + - Added Interface LtrBackupOperationResponseProperties + - Added Interface MetricSpecification + - Added Interface MigrateNetworkStatus + - Added Interface MigrationProperties + - Added Interface MigrationPropertiesForPatch + - Added Interface ObjectRecommendationProperties + - Added Interface OperationProperties + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface PrivateEndpointConnectionProperties + - Added Interface PrivateLinkResourceProperties + - Added Interface RestorePollerOptions + - Added Interface ServerProperties + - Added Interface ServerPropertiesForPatch + - Added Interface ServersMigrateNetworkModeOptionalParams + - Added Interface ServiceSpecification + - Added Interface SimplePollerLike + - Added Interface TuningOptionsProperties + - Added Interface VirtualEndpointResourceProperties + - Interface TuningOptions has a new optional parameter properties + - Added Type Alias AzureSupportedClouds + - Added Type Alias NetworkMigrationState + - Added Type Alias PostgreSqlFlexibleServerHighAvailabilityMode + - Added Enum AzureClouds + - Added Enum KnownNetworkMigrationState + - Added Enum KnownPostgreSqlFlexibleServerHighAvailabilityMode + - Added Enum KnownVersions + - Enum KnownRecommendationTypeEnum has a new value VacuumTable + - Enum KnownRecommendationTypeParameterEnum has a new value VacuumTable + +### Breaking Changes + - Operation AdministratorsMicrosoftEntra.beginDeleteAndWait has a new signature + - Operation BackupsAutomaticAndOnDemand.beginDeleteAndWait has a new signature + - Operation Databases.beginDeleteAndWait has a new signature + - Operation FirewallRules.beginDeleteAndWait has a new signature + - Operation PrivateEndpointConnections.beginDeleteAndWait has a new signature + - Operation Servers.beginDeleteAndWait has a new signature + - Operation Servers.beginRestartAndWait has a new signature + - Operation Servers.beginStartAndWait has a new signature + - Operation Servers.beginStopAndWait has a new signature + - Operation VirtualEndpoints.beginDeleteAndWait has a new signature + - Removed Interface AdministratorMicrosoftEntraList + - Removed Interface AdvancedThreatProtectionSettingsList + - Removed Interface BackupAutomaticAndOnDemandList + - Removed Interface CapabilityList + - Removed Interface CapturedLogList + - Removed Interface ConfigurationList + - Removed Interface DatabaseList + - Removed Interface FirewallRuleList + - Removed Interface LtrServerBackupOperationList + - Removed Interface MigrationList + - Removed Interface ObjectRecommendationList + - Removed Interface OperationList + - Removed Interface PrivateEndpointConnectionList + - Removed Interface PrivateLinkResourceList + - Removed Interface QuotaUsageList + - Removed Interface ServerList + - Removed Interface TuningOptionsList + - Removed Interface VirtualEndpointsList + - Type of parameter properties of interface Operation is changed from { + [propertyName: string]: Record; + } to OperationProperties + - Removed Type Alias MigrationDetailsLevel + - Removed Enum KnownMigrationDetailsLevel + ## 9.0.0 (2025-11-25) ### Features Added diff --git a/sdk/postgresql/arm-postgresql-flexible/README.md b/sdk/postgresql/arm-postgresql-flexible/README.md index 28901ffade75..9de8f93037b4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/README.md +++ b/sdk/postgresql/arm-postgresql-flexible/README.md @@ -1,13 +1,15 @@ -# Azure PostgreSQLManagementFlexibleServer client library for JavaScript +# Azure PostgreSQLManagement client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure PostgreSQLManagementFlexibleServer client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure PostgreSQLManagement client. The Azure Database for PostgreSQL management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, network configuration, security alert policies, log files and configurations with new business model. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible) | -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-postgresql-flexible) | -[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-postgresql-flexible) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-postgresql-flexible) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-postgresql-flexible?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible/samples) ## Getting started @@ -24,7 +26,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure/arm-postgresql-flexible` package -Install the Azure PostgreSQLManagementFlexibleServer client library for JavaScript with `npm`: +Install the Azure PostgreSQLManagement client library for JavaScript with `npm`: ```bash npm install @azure/arm-postgresql-flexible @@ -32,10 +34,10 @@ npm install @azure/arm-postgresql-flexible ### Create and authenticate a `PostgreSQLManagementFlexibleServerClient` -To create a client object to access the Azure PostgreSQLManagementFlexibleServer API, you will need the `endpoint` of your Azure PostgreSQLManagementFlexibleServer resource and a `credential`. The Azure PostgreSQLManagementFlexibleServer client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure PostgreSQLManagementFlexibleServer resource in the [Azure Portal][azure_portal]. +To create a client object to access the Azure PostgreSQLManagement API, you will need the `endpoint` of your Azure PostgreSQLManagement resource and a `credential`. The Azure PostgreSQLManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure PostgreSQLManagement 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). +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: @@ -43,7 +45,7 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure PostgreSQLManagementFlexibleServer** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +You will also need to **register a new AAD application and grant access to Azure PostgreSQLManagement** 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). @@ -66,14 +68,15 @@ For browser environments, use the `InteractiveBrowserCredential` from the `@azur import { InteractiveBrowserCredential } from "@azure/identity"; import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new PostgreSQLManagementFlexibleServerClient(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). @@ -81,7 +84,7 @@ To use this client library in the browser, first you need to use a bundler. For ### PostgreSQLManagementFlexibleServerClient -`PostgreSQLManagementFlexibleServerClient` is the primary interface for developers using the Azure PostgreSQLManagementFlexibleServer client library. Explore the methods on this client object to understand the different features of the Azure PostgreSQLManagementFlexibleServer service that you can access. +`PostgreSQLManagementFlexibleServerClient` is the primary interface for developers using the Azure PostgreSQLManagement client library. Explore the methods on this client object to understand the different features of the Azure PostgreSQLManagement service that you can access. ## Troubleshooting @@ -99,7 +102,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## Next steps -Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible/samples) directory for detailed examples on how to use this library. ## Contributing @@ -109,9 +112,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - -[azure_cli]: https://learn.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ [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 diff --git a/sdk/postgresql/arm-postgresql-flexible/_meta.json b/sdk/postgresql/arm-postgresql-flexible/_meta.json deleted file mode 100644 index 891f8d669855..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "9cc7633f842575274f715cc02e37c5769ac2742d", - "readme": "specification/postgresql/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\postgresql\\resource-manager\\readme.md --use=@autorest/typescript@6.0.52 --generate-sample=true --tag=package-flexibleserver-2025-08-01 --typescript", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.14.8", - "use": "@autorest/typescript@6.0.52" -} diff --git a/sdk/postgresql/arm-postgresql-flexible/api-extractor.json b/sdk/postgresql/arm-postgresql-flexible/api-extractor.json index 16d81e2eb512..870d6d399477 100644 --- a/sdk/postgresql/arm-postgresql-flexible/api-extractor.json +++ b/sdk/postgresql/arm-postgresql-flexible/api-extractor.json @@ -1,3 +1 @@ -{ - "extends": "../../../api-extractor-base.json" -} +{ "extends": "../../../api-extractor-base.json" } diff --git a/sdk/postgresql/arm-postgresql-flexible/eslint.config.mjs b/sdk/postgresql/arm-postgresql-flexible/eslint.config.mjs new file mode 100644 index 000000000000..6d2f8a5914c3 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/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/postgresql/arm-postgresql-flexible/metadata.json b/sdk/postgresql/arm-postgresql-flexible/metadata.json new file mode 100644 index 000000000000..7e4dfa017d44 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/metadata.json @@ -0,0 +1,279 @@ +{ + "apiVersions": { + "Microsoft.DBforPostgreSQL": "2026-01-01-preview" + }, + "emitterVersion": "0.50.4", + "crossLanguageDefinitions": { + "CrossLanguagePackageId": "Microsoft.DBforPostgreSQL", + "CrossLanguageDefinitionId": { + "@azure/arm-postgresql-flexible!OperationList:interface": "Microsoft.DBforPostgreSQL.OperationList", + "@azure/arm-postgresql-flexible!Operation:interface": "Microsoft.DBforPostgreSQL.Operation", + "@azure/arm-postgresql-flexible!OperationDisplay:interface": "Microsoft.DBforPostgreSQL.OperationDisplay", + "@azure/arm-postgresql-flexible!OperationProperties:interface": "Microsoft.DBforPostgreSQL.OperationProperties", + "@azure/arm-postgresql-flexible!ServiceSpecification:interface": "Microsoft.DBforPostgreSQL.ServiceSpecification", + "@azure/arm-postgresql-flexible!MetricSpecification:interface": "Microsoft.DBforPostgreSQL.MetricSpecification", + "@azure/arm-postgresql-flexible!LogSpecification:interface": "Microsoft.DBforPostgreSQL.LogSpecification", + "@azure/arm-postgresql-flexible!ErrorResponse:interface": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "@azure/arm-postgresql-flexible!ErrorDetail:interface": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "@azure/arm-postgresql-flexible!ErrorAdditionalInfo:interface": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "@azure/arm-postgresql-flexible!Migration:interface": "Microsoft.DBforPostgreSQL.Migration", + "@azure/arm-postgresql-flexible!MigrationProperties:interface": "Microsoft.DBforPostgreSQL.MigrationProperties", + "@azure/arm-postgresql-flexible!MigrationStatus:interface": "Microsoft.DBforPostgreSQL.MigrationStatus", + "@azure/arm-postgresql-flexible!MigrationSubstateDetails:interface": "Microsoft.DBforPostgreSQL.MigrationSubstateDetails", + "@azure/arm-postgresql-flexible!DatabaseMigrationState:interface": "Microsoft.DBforPostgreSQL.DatabaseMigrationState", + "@azure/arm-postgresql-flexible!ValidationDetails:interface": "Microsoft.DBforPostgreSQL.ValidationDetails", + "@azure/arm-postgresql-flexible!ValidationSummaryItem:interface": "Microsoft.DBforPostgreSQL.ValidationSummaryItem", + "@azure/arm-postgresql-flexible!ValidationMessage:interface": "Microsoft.DBforPostgreSQL.ValidationMessage", + "@azure/arm-postgresql-flexible!DbLevelValidationStatus:interface": "Microsoft.DBforPostgreSQL.DbLevelValidationStatus", + "@azure/arm-postgresql-flexible!DbServerMetadata:interface": "Microsoft.DBforPostgreSQL.DbServerMetadata", + "@azure/arm-postgresql-flexible!ServerSku:interface": "Microsoft.DBforPostgreSQL.ServerSku", + "@azure/arm-postgresql-flexible!MigrationSecretParameters:interface": "Microsoft.DBforPostgreSQL.MigrationSecretParameters", + "@azure/arm-postgresql-flexible!AdminCredentials:interface": "Microsoft.DBforPostgreSQL.AdminCredentials", + "@azure/arm-postgresql-flexible!TrackedResource:interface": "Azure.ResourceManager.CommonTypes.TrackedResource", + "@azure/arm-postgresql-flexible!Resource:interface": "Azure.ResourceManager.CommonTypes.Resource", + "@azure/arm-postgresql-flexible!SystemData:interface": "Azure.ResourceManager.CommonTypes.SystemData", + "@azure/arm-postgresql-flexible!MigrationResourceForPatch:interface": "Microsoft.DBforPostgreSQL.MigrationResourceForPatch", + "@azure/arm-postgresql-flexible!MigrationPropertiesForPatch:interface": "Microsoft.DBforPostgreSQL.MigrationPropertiesForPatch", + "@azure/arm-postgresql-flexible!MigrationSecretParametersForPatch:interface": "Microsoft.DBforPostgreSQL.MigrationSecretParametersForPatch", + "@azure/arm-postgresql-flexible!AdminCredentialsForPatch:interface": "Microsoft.DBforPostgreSQL.AdminCredentialsForPatch", + "@azure/arm-postgresql-flexible!MigrationList:interface": "Microsoft.DBforPostgreSQL.MigrationList", + "@azure/arm-postgresql-flexible!MigrationNameAvailability:interface": "Microsoft.DBforPostgreSQL.MigrationNameAvailability", + "@azure/arm-postgresql-flexible!Server:interface": "Microsoft.DBforPostgreSQL.Server", + "@azure/arm-postgresql-flexible!ServerProperties:interface": "Microsoft.DBforPostgreSQL.ServerProperties", + "@azure/arm-postgresql-flexible!Storage:interface": "Microsoft.DBforPostgreSQL.Storage", + "@azure/arm-postgresql-flexible!AuthConfig:interface": "Microsoft.DBforPostgreSQL.AuthConfig", + "@azure/arm-postgresql-flexible!DataEncryption:interface": "Microsoft.DBforPostgreSQL.DataEncryption", + "@azure/arm-postgresql-flexible!Backup:interface": "Microsoft.DBforPostgreSQL.Backup", + "@azure/arm-postgresql-flexible!Network:interface": "Microsoft.DBforPostgreSQL.Network", + "@azure/arm-postgresql-flexible!HighAvailability:interface": "Microsoft.DBforPostgreSQL.HighAvailability", + "@azure/arm-postgresql-flexible!MaintenanceWindow:interface": "Microsoft.DBforPostgreSQL.MaintenanceWindow", + "@azure/arm-postgresql-flexible!Replica:interface": "Microsoft.DBforPostgreSQL.Replica", + "@azure/arm-postgresql-flexible!PrivateEndpointConnection:interface": "Microsoft.DBforPostgreSQL.PrivateEndpointConnection", + "@azure/arm-postgresql-flexible!PrivateEndpointConnectionProperties:interface": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties", + "@azure/arm-postgresql-flexible!PrivateEndpoint:interface": "Azure.ResourceManager.CommonTypes.PrivateEndpoint", + "@azure/arm-postgresql-flexible!PrivateLinkServiceConnectionState:interface": "Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState", + "@azure/arm-postgresql-flexible!Cluster:interface": "Microsoft.DBforPostgreSQL.Cluster", + "@azure/arm-postgresql-flexible!Sku:interface": "Microsoft.DBforPostgreSQL.Sku", + "@azure/arm-postgresql-flexible!UserAssignedIdentity:interface": "Microsoft.DBforPostgreSQL.UserAssignedIdentity", + "@azure/arm-postgresql-flexible!UserIdentity:interface": "Microsoft.DBforPostgreSQL.UserIdentity", + "@azure/arm-postgresql-flexible!ArmOperationStatusResourceProvisioningState:interface": "Azure.ResourceManager.ArmOperationStatus", + "@azure/arm-postgresql-flexible!ServerForPatch:interface": "Microsoft.DBforPostgreSQL.ServerForPatch", + "@azure/arm-postgresql-flexible!SkuForPatch:interface": "Microsoft.DBforPostgreSQL.SkuForPatch", + "@azure/arm-postgresql-flexible!ServerPropertiesForPatch:interface": "Microsoft.DBforPostgreSQL.ServerPropertiesForPatch", + "@azure/arm-postgresql-flexible!BackupForPatch:interface": "Microsoft.DBforPostgreSQL.BackupForPatch", + "@azure/arm-postgresql-flexible!HighAvailabilityForPatch:interface": "Microsoft.DBforPostgreSQL.HighAvailabilityForPatch", + "@azure/arm-postgresql-flexible!MaintenanceWindowForPatch:interface": "Microsoft.DBforPostgreSQL.MaintenanceWindowForPatch", + "@azure/arm-postgresql-flexible!AuthConfigForPatch:interface": "Microsoft.DBforPostgreSQL.AuthConfigForPatch", + "@azure/arm-postgresql-flexible!ServerList:interface": "Microsoft.DBforPostgreSQL.ServerList", + "@azure/arm-postgresql-flexible!RestartParameter:interface": "Microsoft.DBforPostgreSQL.RestartParameter", + "@azure/arm-postgresql-flexible!MigrateNetworkStatus:interface": "Microsoft.DBforPostgreSQL.MigrateNetworkStatus", + "@azure/arm-postgresql-flexible!Configuration:interface": "Microsoft.DBforPostgreSQL.Configuration", + "@azure/arm-postgresql-flexible!ConfigurationProperties:interface": "Microsoft.DBforPostgreSQL.ConfigurationProperties", + "@azure/arm-postgresql-flexible!ProxyResource:interface": "Azure.ResourceManager.CommonTypes.ProxyResource", + "@azure/arm-postgresql-flexible!ConfigurationForUpdate:interface": "Microsoft.DBforPostgreSQL.ConfigurationForUpdate", + "@azure/arm-postgresql-flexible!ConfigurationList:interface": "Microsoft.DBforPostgreSQL.ConfigurationList", + "@azure/arm-postgresql-flexible!Database:interface": "Microsoft.DBforPostgreSQL.Database", + "@azure/arm-postgresql-flexible!DatabaseProperties:interface": "Microsoft.DBforPostgreSQL.DatabaseProperties", + "@azure/arm-postgresql-flexible!DatabaseList:interface": "Microsoft.DBforPostgreSQL.DatabaseList", + "@azure/arm-postgresql-flexible!FirewallRule:interface": "Microsoft.DBforPostgreSQL.FirewallRule", + "@azure/arm-postgresql-flexible!FirewallRuleProperties:interface": "Microsoft.DBforPostgreSQL.FirewallRuleProperties", + "@azure/arm-postgresql-flexible!FirewallRuleList:interface": "Microsoft.DBforPostgreSQL.FirewallRuleList", + "@azure/arm-postgresql-flexible!PrivateEndpointConnectionList:interface": "Microsoft.DBforPostgreSQL.PrivateEndpointConnectionList", + "@azure/arm-postgresql-flexible!PrivateLinkResource:interface": "Microsoft.DBforPostgreSQL.PrivateLinkResource", + "@azure/arm-postgresql-flexible!PrivateLinkResourceProperties:interface": "Azure.ResourceManager.CommonTypes.PrivateLinkResourceProperties", + "@azure/arm-postgresql-flexible!PrivateLinkResourceList:interface": "Microsoft.DBforPostgreSQL.PrivateLinkResourceList", + "@azure/arm-postgresql-flexible!VirtualEndpoint:interface": "Microsoft.DBforPostgreSQL.VirtualEndpoint", + "@azure/arm-postgresql-flexible!VirtualEndpointResourceProperties:interface": "Microsoft.DBforPostgreSQL.VirtualEndpointResourceProperties", + "@azure/arm-postgresql-flexible!VirtualEndpointResourceForPatch:interface": "Microsoft.DBforPostgreSQL.VirtualEndpointResourceForPatch", + "@azure/arm-postgresql-flexible!VirtualEndpointsList:interface": "Microsoft.DBforPostgreSQL.VirtualEndpointsList", + "@azure/arm-postgresql-flexible!AdministratorMicrosoftEntra:interface": "Microsoft.DBforPostgreSQL.AdministratorMicrosoftEntra", + "@azure/arm-postgresql-flexible!AdministratorMicrosoftEntraProperties:interface": "Microsoft.DBforPostgreSQL.AdministratorMicrosoftEntraProperties", + "@azure/arm-postgresql-flexible!AdministratorMicrosoftEntraAdd:interface": "Microsoft.DBforPostgreSQL.AdministratorMicrosoftEntraAdd", + "@azure/arm-postgresql-flexible!AdministratorMicrosoftEntraPropertiesForAdd:interface": "Microsoft.DBforPostgreSQL.AdministratorMicrosoftEntraPropertiesForAdd", + "@azure/arm-postgresql-flexible!AdministratorMicrosoftEntraList:interface": "Microsoft.DBforPostgreSQL.AdministratorMicrosoftEntraList", + "@azure/arm-postgresql-flexible!CapabilityList:interface": "Microsoft.DBforPostgreSQL.CapabilityList", + "@azure/arm-postgresql-flexible!Capability:interface": "Microsoft.DBforPostgreSQL.Capability", + "@azure/arm-postgresql-flexible!ServerEditionCapability:interface": "Microsoft.DBforPostgreSQL.ServerEditionCapability", + "@azure/arm-postgresql-flexible!StorageEditionCapability:interface": "Microsoft.DBforPostgreSQL.StorageEditionCapability", + "@azure/arm-postgresql-flexible!StorageMbCapability:interface": "Microsoft.DBforPostgreSQL.StorageMbCapability", + "@azure/arm-postgresql-flexible!StorageTierCapability:interface": "Microsoft.DBforPostgreSQL.StorageTierCapability", + "@azure/arm-postgresql-flexible!CapabilityBase:interface": "Microsoft.DBforPostgreSQL.CapabilityBase", + "@azure/arm-postgresql-flexible!ServerSkuCapability:interface": "Microsoft.DBforPostgreSQL.ServerSkuCapability", + "@azure/arm-postgresql-flexible!SupportedFeature:interface": "Microsoft.DBforPostgreSQL.SupportedFeature", + "@azure/arm-postgresql-flexible!ServerVersionCapability:interface": "Microsoft.DBforPostgreSQL.ServerVersionCapability", + "@azure/arm-postgresql-flexible!FastProvisioningEditionCapability:interface": "Microsoft.DBforPostgreSQL.FastProvisioningEditionCapability", + "@azure/arm-postgresql-flexible!CapturedLogList:interface": "Microsoft.DBforPostgreSQL.CapturedLogList", + "@azure/arm-postgresql-flexible!CapturedLog:interface": "Microsoft.DBforPostgreSQL.CapturedLog", + "@azure/arm-postgresql-flexible!CapturedLogProperties:interface": "Microsoft.DBforPostgreSQL.CapturedLogProperties", + "@azure/arm-postgresql-flexible!LtrPreBackupRequest:interface": "Microsoft.DBforPostgreSQL.LtrPreBackupRequest", + "@azure/arm-postgresql-flexible!BackupRequestBase:interface": "Microsoft.DBforPostgreSQL.BackupRequestBase", + "@azure/arm-postgresql-flexible!BackupSettings:interface": "Microsoft.DBforPostgreSQL.BackupSettings", + "@azure/arm-postgresql-flexible!LtrPreBackupResponse:interface": "Microsoft.DBforPostgreSQL.LtrPreBackupResponse", + "@azure/arm-postgresql-flexible!BackupsLongTermRetentionResponseProperties:interface": "Microsoft.DBforPostgreSQL.BackupsLongTermRetentionResponseProperties", + "@azure/arm-postgresql-flexible!BackupsLongTermRetentionRequest:interface": "Microsoft.DBforPostgreSQL.BackupsLongTermRetentionRequest", + "@azure/arm-postgresql-flexible!BackupStoreDetails:interface": "Microsoft.DBforPostgreSQL.BackupStoreDetails", + "@azure/arm-postgresql-flexible!BackupsLongTermRetentionResponse:interface": "Microsoft.DBforPostgreSQL.BackupsLongTermRetentionResponse", + "@azure/arm-postgresql-flexible!LtrBackupOperationResponseProperties:interface": "Microsoft.DBforPostgreSQL.LtrBackupOperationResponseProperties", + "@azure/arm-postgresql-flexible!BackupsLongTermRetentionOperation:interface": "Microsoft.DBforPostgreSQL.BackupsLongTermRetentionOperation", + "@azure/arm-postgresql-flexible!LtrServerBackupOperationList:interface": "Microsoft.DBforPostgreSQL.LtrServerBackupOperationList", + "@azure/arm-postgresql-flexible!AdvancedThreatProtectionSettingsModel:interface": "Microsoft.DBforPostgreSQL.AdvancedThreatProtectionSettingsModel", + "@azure/arm-postgresql-flexible!AdvancedThreatProtectionSettingsProperties:interface": "Microsoft.DBforPostgreSQL.AdvancedThreatProtectionSettingsProperties", + "@azure/arm-postgresql-flexible!AdvancedThreatProtectionSettingsList:interface": "Microsoft.DBforPostgreSQL.AdvancedThreatProtectionSettingsList", + "@azure/arm-postgresql-flexible!BackupAutomaticAndOnDemand:interface": "Microsoft.DBforPostgreSQL.BackupAutomaticAndOnDemand", + "@azure/arm-postgresql-flexible!BackupAutomaticAndOnDemandProperties:interface": "Microsoft.DBforPostgreSQL.BackupAutomaticAndOnDemandProperties", + "@azure/arm-postgresql-flexible!BackupAutomaticAndOnDemandList:interface": "Microsoft.DBforPostgreSQL.BackupAutomaticAndOnDemandList", + "@azure/arm-postgresql-flexible!TuningOptions:interface": "Microsoft.DBforPostgreSQL.TuningOptions", + "@azure/arm-postgresql-flexible!TuningOptionsProperties:interface": "Microsoft.DBforPostgreSQL.TuningOptionsProperties", + "@azure/arm-postgresql-flexible!TuningOptionsList:interface": "Microsoft.DBforPostgreSQL.TuningOptionsList", + "@azure/arm-postgresql-flexible!ObjectRecommendationList:interface": "Microsoft.DBforPostgreSQL.ObjectRecommendationList", + "@azure/arm-postgresql-flexible!ObjectRecommendation:interface": "Microsoft.DBforPostgreSQL.ObjectRecommendation", + "@azure/arm-postgresql-flexible!ObjectRecommendationProperties:interface": "Microsoft.DBforPostgreSQL.ObjectRecommendationProperties", + "@azure/arm-postgresql-flexible!ObjectRecommendationPropertiesImplementationDetails:interface": "Microsoft.DBforPostgreSQL.ObjectRecommendationPropertiesImplementationDetails", + "@azure/arm-postgresql-flexible!ObjectRecommendationPropertiesAnalyzedWorkload:interface": "Microsoft.DBforPostgreSQL.ObjectRecommendationPropertiesAnalyzedWorkload", + "@azure/arm-postgresql-flexible!ImpactRecord:interface": "Microsoft.DBforPostgreSQL.ImpactRecord", + "@azure/arm-postgresql-flexible!ObjectRecommendationDetails:interface": "Microsoft.DBforPostgreSQL.ObjectRecommendationDetails", + "@azure/arm-postgresql-flexible!CheckNameAvailabilityRequest:interface": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest", + "@azure/arm-postgresql-flexible!NameAvailabilityModel:interface": "Microsoft.DBforPostgreSQL.NameAvailabilityModel", + "@azure/arm-postgresql-flexible!CheckNameAvailabilityResponse:interface": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse", + "@azure/arm-postgresql-flexible!QuotaUsageList:interface": "Microsoft.DBforPostgreSQL.QuotaUsageList", + "@azure/arm-postgresql-flexible!QuotaUsage:interface": "Microsoft.DBforPostgreSQL.QuotaUsage", + "@azure/arm-postgresql-flexible!NameProperty:interface": "Microsoft.DBforPostgreSQL.NameProperty", + "@azure/arm-postgresql-flexible!VirtualNetworkSubnetUsageParameter:interface": "Microsoft.DBforPostgreSQL.VirtualNetworkSubnetUsageParameter", + "@azure/arm-postgresql-flexible!VirtualNetworkSubnetUsageModel:interface": "Microsoft.DBforPostgreSQL.VirtualNetworkSubnetUsageModel", + "@azure/arm-postgresql-flexible!DelegatedSubnetUsage:interface": "Microsoft.DBforPostgreSQL.DelegatedSubnetUsage", + "@azure/arm-postgresql-flexible!KnownOperationOrigin:enum": "Microsoft.DBforPostgreSQL.OperationOrigin", + "@azure/arm-postgresql-flexible!KnownMigrationState:enum": "Microsoft.DBforPostgreSQL.MigrationState", + "@azure/arm-postgresql-flexible!KnownMigrationSubstate:enum": "Microsoft.DBforPostgreSQL.MigrationSubstate", + "@azure/arm-postgresql-flexible!KnownMigrationDatabaseState:enum": "Microsoft.DBforPostgreSQL.MigrationDatabaseState", + "@azure/arm-postgresql-flexible!KnownValidationState:enum": "Microsoft.DBforPostgreSQL.ValidationState", + "@azure/arm-postgresql-flexible!KnownMigrationMode:enum": "Microsoft.DBforPostgreSQL.MigrationMode", + "@azure/arm-postgresql-flexible!KnownMigrationOption:enum": "Microsoft.DBforPostgreSQL.MigrationOption", + "@azure/arm-postgresql-flexible!KnownSourceType:enum": "Microsoft.DBforPostgreSQL.SourceType", + "@azure/arm-postgresql-flexible!KnownSslMode:enum": "Microsoft.DBforPostgreSQL.SslMode", + "@azure/arm-postgresql-flexible!KnownSkuTier:enum": "Microsoft.DBforPostgreSQL.SkuTier", + "@azure/arm-postgresql-flexible!KnownLogicalReplicationOnSourceServer:enum": "Microsoft.DBforPostgreSQL.LogicalReplicationOnSourceServer", + "@azure/arm-postgresql-flexible!KnownOverwriteDatabasesOnTargetServer:enum": "Microsoft.DBforPostgreSQL.OverwriteDatabasesOnTargetServer", + "@azure/arm-postgresql-flexible!KnownMigrateRolesAndPermissions:enum": "Microsoft.DBforPostgreSQL.MigrateRolesAndPermissions", + "@azure/arm-postgresql-flexible!KnownStartDataMigration:enum": "Microsoft.DBforPostgreSQL.StartDataMigration", + "@azure/arm-postgresql-flexible!KnownTriggerCutover:enum": "Microsoft.DBforPostgreSQL.TriggerCutover", + "@azure/arm-postgresql-flexible!KnownCancel:enum": "Microsoft.DBforPostgreSQL.Cancel", + "@azure/arm-postgresql-flexible!KnowncreatedByType:enum": "Azure.ResourceManager.CommonTypes.createdByType", + "@azure/arm-postgresql-flexible!KnownMigrationListFilter:enum": "Microsoft.DBforPostgreSQL.MigrationListFilter", + "@azure/arm-postgresql-flexible!KnownMigrationNameAvailabilityReason:enum": "Microsoft.DBforPostgreSQL.MigrationNameAvailabilityReason", + "@azure/arm-postgresql-flexible!KnownPostgresMajorVersion:enum": "Microsoft.DBforPostgreSQL.PostgresMajorVersion", + "@azure/arm-postgresql-flexible!KnownServerState:enum": "Microsoft.DBforPostgreSQL.ServerState", + "@azure/arm-postgresql-flexible!KnownStorageAutoGrow:enum": "Microsoft.DBforPostgreSQL.StorageAutoGrow", + "@azure/arm-postgresql-flexible!KnownAzureManagedDiskPerformanceTier:enum": "Microsoft.DBforPostgreSQL.AzureManagedDiskPerformanceTier", + "@azure/arm-postgresql-flexible!KnownStorageType:enum": "Microsoft.DBforPostgreSQL.StorageType", + "@azure/arm-postgresql-flexible!KnownMicrosoftEntraAuth:enum": "Microsoft.DBforPostgreSQL.MicrosoftEntraAuth", + "@azure/arm-postgresql-flexible!KnownPasswordBasedAuth:enum": "Microsoft.DBforPostgreSQL.PasswordBasedAuth", + "@azure/arm-postgresql-flexible!KnownDataEncryptionType:enum": "Microsoft.DBforPostgreSQL.DataEncryptionType", + "@azure/arm-postgresql-flexible!KnownEncryptionKeyStatus:enum": "Microsoft.DBforPostgreSQL.EncryptionKeyStatus", + "@azure/arm-postgresql-flexible!KnownGeographicallyRedundantBackup:enum": "Microsoft.DBforPostgreSQL.GeographicallyRedundantBackup", + "@azure/arm-postgresql-flexible!KnownServerPublicNetworkAccessState:enum": "Microsoft.DBforPostgreSQL.ServerPublicNetworkAccessState", + "@azure/arm-postgresql-flexible!KnownPostgreSqlFlexibleServerHighAvailabilityMode:enum": "Microsoft.DBforPostgreSQL.PostgreSqlFlexibleServerHighAvailabilityMode", + "@azure/arm-postgresql-flexible!KnownHighAvailabilityState:enum": "Microsoft.DBforPostgreSQL.HighAvailabilityState", + "@azure/arm-postgresql-flexible!KnownReplicationRole:enum": "Microsoft.DBforPostgreSQL.ReplicationRole", + "@azure/arm-postgresql-flexible!KnownReplicationState:enum": "Microsoft.DBforPostgreSQL.ReplicationState", + "@azure/arm-postgresql-flexible!KnownReadReplicaPromoteMode:enum": "Microsoft.DBforPostgreSQL.ReadReplicaPromoteMode", + "@azure/arm-postgresql-flexible!KnownReadReplicaPromoteOption:enum": "Microsoft.DBforPostgreSQL.ReadReplicaPromoteOption", + "@azure/arm-postgresql-flexible!KnownCreateMode:enum": "Microsoft.DBforPostgreSQL.CreateMode", + "@azure/arm-postgresql-flexible!KnownPrivateEndpointServiceConnectionStatus:enum": "Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus", + "@azure/arm-postgresql-flexible!KnownPrivateEndpointConnectionProvisioningState:enum": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState", + "@azure/arm-postgresql-flexible!KnownIdentityType:enum": "Microsoft.DBforPostgreSQL.IdentityType", + "@azure/arm-postgresql-flexible!KnownResourceProvisioningState:enum": "Azure.ResourceManager.ResourceProvisioningState", + "@azure/arm-postgresql-flexible!KnownCreateModeForPatch:enum": "Microsoft.DBforPostgreSQL.CreateModeForPatch", + "@azure/arm-postgresql-flexible!KnownFailoverMode:enum": "Microsoft.DBforPostgreSQL.FailoverMode", + "@azure/arm-postgresql-flexible!KnownNetworkMigrationState:enum": "Microsoft.DBforPostgreSQL.NetworkMigrationState", + "@azure/arm-postgresql-flexible!KnownConfigurationDataType:enum": "Microsoft.DBforPostgreSQL.ConfigurationDataType", + "@azure/arm-postgresql-flexible!KnownVirtualEndpointType:enum": "Microsoft.DBforPostgreSQL.VirtualEndpointType", + "@azure/arm-postgresql-flexible!KnownPrincipalType:enum": "Microsoft.DBforPostgreSQL.PrincipalType", + "@azure/arm-postgresql-flexible!KnownCapabilityStatus:enum": "Microsoft.DBforPostgreSQL.CapabilityStatus", + "@azure/arm-postgresql-flexible!KnownHighAvailabilityMode:enum": "Microsoft.DBforPostgreSQL.HighAvailabilityMode", + "@azure/arm-postgresql-flexible!KnownFeatureStatus:enum": "Microsoft.DBforPostgreSQL.FeatureStatus", + "@azure/arm-postgresql-flexible!KnownFastProvisioningSupport:enum": "Microsoft.DBforPostgreSQL.FastProvisioningSupport", + "@azure/arm-postgresql-flexible!KnownGeographicallyRedundantBackupSupport:enum": "Microsoft.DBforPostgreSQL.GeographicallyRedundantBackupSupport", + "@azure/arm-postgresql-flexible!KnownZoneRedundantHighAvailabilitySupport:enum": "Microsoft.DBforPostgreSQL.ZoneRedundantHighAvailabilitySupport", + "@azure/arm-postgresql-flexible!KnownZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport:enum": "Microsoft.DBforPostgreSQL.ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport", + "@azure/arm-postgresql-flexible!KnownStorageAutoGrowthSupport:enum": "Microsoft.DBforPostgreSQL.StorageAutoGrowthSupport", + "@azure/arm-postgresql-flexible!KnownOnlineStorageResizeSupport:enum": "Microsoft.DBforPostgreSQL.OnlineStorageResizeSupport", + "@azure/arm-postgresql-flexible!KnownLocationRestricted:enum": "Microsoft.DBforPostgreSQL.LocationRestricted", + "@azure/arm-postgresql-flexible!KnownExecutionStatus:enum": "Microsoft.DBforPostgreSQL.ExecutionStatus", + "@azure/arm-postgresql-flexible!KnownThreatProtectionName:enum": "Microsoft.DBforPostgreSQL.ThreatProtectionName", + "@azure/arm-postgresql-flexible!KnownThreatProtectionState:enum": "Microsoft.DBforPostgreSQL.ThreatProtectionState", + "@azure/arm-postgresql-flexible!KnownBackupType:enum": "Microsoft.DBforPostgreSQL.BackupType", + "@azure/arm-postgresql-flexible!KnownTuningOptionParameterEnum:enum": "Microsoft.DBforPostgreSQL.TuningOptionParameterEnum", + "@azure/arm-postgresql-flexible!KnownRecommendationTypeParameterEnum:enum": "Microsoft.DBforPostgreSQL.RecommendationTypeParameterEnum", + "@azure/arm-postgresql-flexible!KnownRecommendationTypeEnum:enum": "Microsoft.DBforPostgreSQL.RecommendationTypeEnum", + "@azure/arm-postgresql-flexible!KnownCheckNameAvailabilityReason:enum": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason", + "@azure/arm-postgresql-flexible!KnownVersions:enum": "Microsoft.DBforPostgreSQL.Versions", + "@azure/arm-postgresql-flexible!VirtualNetworkSubnetUsageOperations#list:member": "Microsoft.DBforPostgreSQL.VirtualNetworkSubnetUsageOperationGroup.list", + "@azure/arm-postgresql-flexible!QuotaUsagesOperations#list:member": "Microsoft.DBforPostgreSQL.QuotaUsagesOperationGroup.list", + "@azure/arm-postgresql-flexible!PrivateDnsZoneSuffixOperations#get:member": "Microsoft.DBforPostgreSQL.PrivateDnsZoneSuffixOperationGroup.get", + "@azure/arm-postgresql-flexible!NameAvailabilityOperations#checkWithLocation:member": "Microsoft.DBforPostgreSQL.NameAvailabilityOperationGroup.checkWithLocation", + "@azure/arm-postgresql-flexible!NameAvailabilityOperations#checkGlobally:member": "Microsoft.DBforPostgreSQL.NameAvailabilityOperationGroup.checkGlobally", + "@azure/arm-postgresql-flexible!CapabilitiesByLocationOperations#list:member": "Microsoft.DBforPostgreSQL.CapabilitiesByLocationOperationGroup.list", + "@azure/arm-postgresql-flexible!TuningOptionsOperations#listRecommendations:member": "Microsoft.DBforPostgreSQL.TuningOptionsOperationGroup.listRecommendations", + "@azure/arm-postgresql-flexible!TuningOptionsOperations#listByServer:member": "Microsoft.DBforPostgreSQL.TuningOptionsOperationGroup.listByServer", + "@azure/arm-postgresql-flexible!TuningOptionsOperations#get:member": "Microsoft.DBforPostgreSQL.TuningOptionsOperationGroup.get", + "@azure/arm-postgresql-flexible!BackupsAutomaticAndOnDemandOperations#listByServer:member": "Microsoft.DBforPostgreSQL.BackupAutomaticAndOnDemands.listByServer", + "@azure/arm-postgresql-flexible!BackupsAutomaticAndOnDemandOperations#delete:member": "Microsoft.DBforPostgreSQL.BackupAutomaticAndOnDemands.delete", + "@azure/arm-postgresql-flexible!BackupsAutomaticAndOnDemandOperations#create:member": "Microsoft.DBforPostgreSQL.BackupAutomaticAndOnDemands.create", + "@azure/arm-postgresql-flexible!BackupsAutomaticAndOnDemandOperations#get:member": "Microsoft.DBforPostgreSQL.BackupAutomaticAndOnDemands.get", + "@azure/arm-postgresql-flexible!ServerThreatProtectionSettingsOperations#createOrUpdate:member": "Microsoft.DBforPostgreSQL.AdvancedThreatProtectionSettingsModels.createOrUpdate", + "@azure/arm-postgresql-flexible!AdvancedThreatProtectionSettingsOperations#listByServer:member": "Microsoft.DBforPostgreSQL.AdvancedThreatProtectionSettingsModels.listByServer", + "@azure/arm-postgresql-flexible!AdvancedThreatProtectionSettingsOperations#get:member": "Microsoft.DBforPostgreSQL.AdvancedThreatProtectionSettingsModels.get", + "@azure/arm-postgresql-flexible!ReplicasOperations#ListByServer:member": "Microsoft.DBforPostgreSQL.Servers.replicasListByServer", + "@azure/arm-postgresql-flexible!BackupsLongTermRetentionOperations#listByServer:member": "Microsoft.DBforPostgreSQL.BackupsLongTermRetentionOperations.listByServer", + "@azure/arm-postgresql-flexible!BackupsLongTermRetentionOperations#get:member": "Microsoft.DBforPostgreSQL.BackupsLongTermRetentionOperations.get", + "@azure/arm-postgresql-flexible!BackupsLongTermRetentionOperations#start:member": "Microsoft.DBforPostgreSQL.Servers.start", + "@azure/arm-postgresql-flexible!BackupsLongTermRetentionOperations#checkPrerequisites:member": "Microsoft.DBforPostgreSQL.Servers.checkPrerequisites", + "@azure/arm-postgresql-flexible!CapturedLogsOperations#listByServer:member": "Microsoft.DBforPostgreSQL.Servers.listByServer", + "@azure/arm-postgresql-flexible!CapabilitiesByServerOperations#list:member": "Microsoft.DBforPostgreSQL.Servers.list", + "@azure/arm-postgresql-flexible!AdministratorsMicrosoftEntraOperations#listByServer:member": "Microsoft.DBforPostgreSQL.AdministratorMicrosoftEntras.listByServer", + "@azure/arm-postgresql-flexible!AdministratorsMicrosoftEntraOperations#delete:member": "Microsoft.DBforPostgreSQL.AdministratorMicrosoftEntras.delete", + "@azure/arm-postgresql-flexible!AdministratorsMicrosoftEntraOperations#createOrUpdate:member": "Microsoft.DBforPostgreSQL.AdministratorMicrosoftEntras.createOrUpdate", + "@azure/arm-postgresql-flexible!AdministratorsMicrosoftEntraOperations#get:member": "Microsoft.DBforPostgreSQL.AdministratorMicrosoftEntras.get", + "@azure/arm-postgresql-flexible!VirtualEndpointsOperations#listByServer:member": "Microsoft.DBforPostgreSQL.VirtualEndpoints.listByServer", + "@azure/arm-postgresql-flexible!VirtualEndpointsOperations#delete:member": "Microsoft.DBforPostgreSQL.VirtualEndpoints.delete", + "@azure/arm-postgresql-flexible!VirtualEndpointsOperations#update:member": "Microsoft.DBforPostgreSQL.VirtualEndpoints.update", + "@azure/arm-postgresql-flexible!VirtualEndpointsOperations#create:member": "Microsoft.DBforPostgreSQL.VirtualEndpoints.create", + "@azure/arm-postgresql-flexible!VirtualEndpointsOperations#get:member": "Microsoft.DBforPostgreSQL.VirtualEndpoints.get", + "@azure/arm-postgresql-flexible!PrivateLinkResourcesOperations#listByServer:member": "Microsoft.DBforPostgreSQL.PrivateLinkResources.listByServer", + "@azure/arm-postgresql-flexible!PrivateLinkResourcesOperations#get:member": "Microsoft.DBforPostgreSQL.PrivateLinkResources.get", + "@azure/arm-postgresql-flexible!PrivateEndpointConnectionsOperations#listByServer:member": "Microsoft.DBforPostgreSQL.PrivateEndpointConnections.listByServer", + "@azure/arm-postgresql-flexible!PrivateEndpointConnectionsOperations#delete:member": "Microsoft.DBforPostgreSQL.PrivateEndpointConnections.delete", + "@azure/arm-postgresql-flexible!PrivateEndpointConnectionsOperations#update:member": "Microsoft.DBforPostgreSQL.PrivateEndpointConnections.update", + "@azure/arm-postgresql-flexible!PrivateEndpointConnectionsOperations#get:member": "Microsoft.DBforPostgreSQL.PrivateEndpointConnections.get", + "@azure/arm-postgresql-flexible!FirewallRulesOperations#listByServer:member": "Microsoft.DBforPostgreSQL.FirewallRules.listByServer", + "@azure/arm-postgresql-flexible!FirewallRulesOperations#delete:member": "Microsoft.DBforPostgreSQL.FirewallRules.delete", + "@azure/arm-postgresql-flexible!FirewallRulesOperations#createOrUpdate:member": "Microsoft.DBforPostgreSQL.FirewallRules.createOrUpdate", + "@azure/arm-postgresql-flexible!FirewallRulesOperations#get:member": "Microsoft.DBforPostgreSQL.FirewallRules.get", + "@azure/arm-postgresql-flexible!DatabasesOperations#listByServer:member": "Microsoft.DBforPostgreSQL.Databases.listByServer", + "@azure/arm-postgresql-flexible!DatabasesOperations#delete:member": "Microsoft.DBforPostgreSQL.Databases.delete", + "@azure/arm-postgresql-flexible!DatabasesOperations#create:member": "Microsoft.DBforPostgreSQL.Databases.create", + "@azure/arm-postgresql-flexible!DatabasesOperations#get:member": "Microsoft.DBforPostgreSQL.Databases.get", + "@azure/arm-postgresql-flexible!ConfigurationsOperations#listByServer:member": "Microsoft.DBforPostgreSQL.Configurations.listByServer", + "@azure/arm-postgresql-flexible!ConfigurationsOperations#update:member": "Microsoft.DBforPostgreSQL.Configurations.update", + "@azure/arm-postgresql-flexible!ConfigurationsOperations#put:member": "Microsoft.DBforPostgreSQL.Configurations.put", + "@azure/arm-postgresql-flexible!ConfigurationsOperations#get:member": "Microsoft.DBforPostgreSQL.Configurations.get", + "@azure/arm-postgresql-flexible!ServersOperations#migrateNetworkMode:member": "Microsoft.DBforPostgreSQL.Servers.migrateNetworkMode", + "@azure/arm-postgresql-flexible!ServersOperations#stop:member": "Microsoft.DBforPostgreSQL.Servers.stop", + "@azure/arm-postgresql-flexible!ServersOperations#Start:member": "Microsoft.DBforPostgreSQL.Servers.serversStart", + "@azure/arm-postgresql-flexible!ServersOperations#restart:member": "Microsoft.DBforPostgreSQL.Servers.restart", + "@azure/arm-postgresql-flexible!ServersOperations#listBySubscription:member": "Microsoft.DBforPostgreSQL.Servers.listBySubscription", + "@azure/arm-postgresql-flexible!ServersOperations#listByResourceGroup:member": "Microsoft.DBforPostgreSQL.Servers.listByResourceGroup", + "@azure/arm-postgresql-flexible!ServersOperations#delete:member": "Microsoft.DBforPostgreSQL.Servers.delete", + "@azure/arm-postgresql-flexible!ServersOperations#update:member": "Microsoft.DBforPostgreSQL.Servers.update", + "@azure/arm-postgresql-flexible!ServersOperations#createOrUpdate:member": "Microsoft.DBforPostgreSQL.Servers.createOrUpdate", + "@azure/arm-postgresql-flexible!ServersOperations#get:member": "Microsoft.DBforPostgreSQL.Servers.get", + "@azure/arm-postgresql-flexible!MigrationsOperations#checkNameAvailability:member": "Microsoft.DBforPostgreSQL.Servers.checkNameAvailability", + "@azure/arm-postgresql-flexible!MigrationsOperations#listByTargetServer:member": "Microsoft.DBforPostgreSQL.Migrations.listByTargetServer", + "@azure/arm-postgresql-flexible!MigrationsOperations#cancel:member": "Microsoft.DBforPostgreSQL.Migrations.cancel", + "@azure/arm-postgresql-flexible!MigrationsOperations#update:member": "Microsoft.DBforPostgreSQL.Migrations.update", + "@azure/arm-postgresql-flexible!MigrationsOperations#create:member": "Microsoft.DBforPostgreSQL.Migrations.create", + "@azure/arm-postgresql-flexible!MigrationsOperations#get:member": "Microsoft.DBforPostgreSQL.Migrations.get", + "@azure/arm-postgresql-flexible!OperationsOperations#list:member": "Azure.ResourceManager.Legacy.Operations.list" + } + } +} diff --git a/sdk/postgresql/arm-postgresql-flexible/package.json b/sdk/postgresql/arm-postgresql-flexible/package.json index bb94827ee5a0..44a43725484d 100644 --- a/sdk/postgresql/arm-postgresql-flexible/package.json +++ b/sdk/postgresql/arm-postgresql-flexible/package.json @@ -1,93 +1,95 @@ { "name": "@azure/arm-postgresql-flexible", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", + "version": "10.0.0-beta.1", "description": "A generated SDK for PostgreSQLManagementFlexibleServerClient.", - "version": "9.0.0", "engines": { "node": ">=20.0.0" }, - "dependencies": { - "@azure/core-lro": "^2.5.4", - "@azure/abort-controller": "^2.1.2", - "@azure/core-paging": "^1.6.2", - "@azure/core-client": "^1.9.3", - "@azure/core-auth": "^1.9.0", - "@azure/core-rest-pipeline": "^1.19.1", - "tslib": "^2.8.1" - }, + "sideEffects": false, + "autoPublish": false, + "type": "module", + "browser": "./dist/browser/index.js", + "react-native": "./dist/react-native/index.js", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", - "isomorphic", - "cloud" + "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", - "type": "module", + "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/postgresql/arm-postgresql-flexible/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/postgreSQLManagementFlexibleServerContext.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:^", + "@azure/eslint-plugin-azure-sdk": "workspace:^", "@azure/identity": "catalog:internal", - "@azure/logger": "workspace:^", "@types/node": "catalog:", - "@vitest/browser-playwright": "catalog:testing", - "@vitest/coverage-istanbul": "catalog:testing", "cross-env": "catalog:", - "dotenv": "catalog:testing", "eslint": "catalog:", - "playwright": "catalog:testing", "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" }, - "repository": "github:Azure/azure-sdk-for-js", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "files": [ - "dist/", - "README.md", - "LICENSE" - ], "scripts": { - "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", + "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", - "extract-api": "dev-tool run extract-api", "lint": "echo skipped", - "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "lint:fix": "echo skipped", "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", - "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", - "execute:samples": "echo skipped", - "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", - "test": "npm run test:node && npm run test:browser", + "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:browser": "echo skipped", - "update-snippets": "dev-tool run update-snippets", - "test:node:esm": "dev-tool run test:vitest --esm" - }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/postgreSQLManagementFlexibleServerClient.ts", - "prefix": "packageDetails" - } - ] + "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" }, - "autoPublish": true, - "browser": "./dist/browser/index.js", - "react-native": "./dist/react-native/index.js", - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible", "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-postgresql-flexible", "productSlugs": [ "azure" ], @@ -113,6 +115,459 @@ "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/virtualNetworkSubnetUsage": { + "browser": { + "types": "./dist/browser/api/virtualNetworkSubnetUsage/index.d.ts", + "default": "./dist/browser/api/virtualNetworkSubnetUsage/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/virtualNetworkSubnetUsage/index.d.ts", + "default": "./dist/react-native/api/virtualNetworkSubnetUsage/index.js" + }, + "import": { + "types": "./dist/esm/api/virtualNetworkSubnetUsage/index.d.ts", + "default": "./dist/esm/api/virtualNetworkSubnetUsage/index.js" + }, + "require": { + "types": "./dist/commonjs/api/virtualNetworkSubnetUsage/index.d.ts", + "default": "./dist/commonjs/api/virtualNetworkSubnetUsage/index.js" + } + }, + "./api/quotaUsages": { + "browser": { + "types": "./dist/browser/api/quotaUsages/index.d.ts", + "default": "./dist/browser/api/quotaUsages/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/quotaUsages/index.d.ts", + "default": "./dist/react-native/api/quotaUsages/index.js" + }, + "import": { + "types": "./dist/esm/api/quotaUsages/index.d.ts", + "default": "./dist/esm/api/quotaUsages/index.js" + }, + "require": { + "types": "./dist/commonjs/api/quotaUsages/index.d.ts", + "default": "./dist/commonjs/api/quotaUsages/index.js" + } + }, + "./api/privateDnsZoneSuffix": { + "browser": { + "types": "./dist/browser/api/privateDnsZoneSuffix/index.d.ts", + "default": "./dist/browser/api/privateDnsZoneSuffix/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/privateDnsZoneSuffix/index.d.ts", + "default": "./dist/react-native/api/privateDnsZoneSuffix/index.js" + }, + "import": { + "types": "./dist/esm/api/privateDnsZoneSuffix/index.d.ts", + "default": "./dist/esm/api/privateDnsZoneSuffix/index.js" + }, + "require": { + "types": "./dist/commonjs/api/privateDnsZoneSuffix/index.d.ts", + "default": "./dist/commonjs/api/privateDnsZoneSuffix/index.js" + } + }, + "./api/nameAvailability": { + "browser": { + "types": "./dist/browser/api/nameAvailability/index.d.ts", + "default": "./dist/browser/api/nameAvailability/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/nameAvailability/index.d.ts", + "default": "./dist/react-native/api/nameAvailability/index.js" + }, + "import": { + "types": "./dist/esm/api/nameAvailability/index.d.ts", + "default": "./dist/esm/api/nameAvailability/index.js" + }, + "require": { + "types": "./dist/commonjs/api/nameAvailability/index.d.ts", + "default": "./dist/commonjs/api/nameAvailability/index.js" + } + }, + "./api/capabilitiesByLocation": { + "browser": { + "types": "./dist/browser/api/capabilitiesByLocation/index.d.ts", + "default": "./dist/browser/api/capabilitiesByLocation/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/capabilitiesByLocation/index.d.ts", + "default": "./dist/react-native/api/capabilitiesByLocation/index.js" + }, + "import": { + "types": "./dist/esm/api/capabilitiesByLocation/index.d.ts", + "default": "./dist/esm/api/capabilitiesByLocation/index.js" + }, + "require": { + "types": "./dist/commonjs/api/capabilitiesByLocation/index.d.ts", + "default": "./dist/commonjs/api/capabilitiesByLocation/index.js" + } + }, + "./api/tuningOptions": { + "browser": { + "types": "./dist/browser/api/tuningOptions/index.d.ts", + "default": "./dist/browser/api/tuningOptions/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/tuningOptions/index.d.ts", + "default": "./dist/react-native/api/tuningOptions/index.js" + }, + "import": { + "types": "./dist/esm/api/tuningOptions/index.d.ts", + "default": "./dist/esm/api/tuningOptions/index.js" + }, + "require": { + "types": "./dist/commonjs/api/tuningOptions/index.d.ts", + "default": "./dist/commonjs/api/tuningOptions/index.js" + } + }, + "./api/backupsAutomaticAndOnDemand": { + "browser": { + "types": "./dist/browser/api/backupsAutomaticAndOnDemand/index.d.ts", + "default": "./dist/browser/api/backupsAutomaticAndOnDemand/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/backupsAutomaticAndOnDemand/index.d.ts", + "default": "./dist/react-native/api/backupsAutomaticAndOnDemand/index.js" + }, + "import": { + "types": "./dist/esm/api/backupsAutomaticAndOnDemand/index.d.ts", + "default": "./dist/esm/api/backupsAutomaticAndOnDemand/index.js" + }, + "require": { + "types": "./dist/commonjs/api/backupsAutomaticAndOnDemand/index.d.ts", + "default": "./dist/commonjs/api/backupsAutomaticAndOnDemand/index.js" + } + }, + "./api/serverThreatProtectionSettings": { + "browser": { + "types": "./dist/browser/api/serverThreatProtectionSettings/index.d.ts", + "default": "./dist/browser/api/serverThreatProtectionSettings/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/serverThreatProtectionSettings/index.d.ts", + "default": "./dist/react-native/api/serverThreatProtectionSettings/index.js" + }, + "import": { + "types": "./dist/esm/api/serverThreatProtectionSettings/index.d.ts", + "default": "./dist/esm/api/serverThreatProtectionSettings/index.js" + }, + "require": { + "types": "./dist/commonjs/api/serverThreatProtectionSettings/index.d.ts", + "default": "./dist/commonjs/api/serverThreatProtectionSettings/index.js" + } + }, + "./api/advancedThreatProtectionSettings": { + "browser": { + "types": "./dist/browser/api/advancedThreatProtectionSettings/index.d.ts", + "default": "./dist/browser/api/advancedThreatProtectionSettings/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/advancedThreatProtectionSettings/index.d.ts", + "default": "./dist/react-native/api/advancedThreatProtectionSettings/index.js" + }, + "import": { + "types": "./dist/esm/api/advancedThreatProtectionSettings/index.d.ts", + "default": "./dist/esm/api/advancedThreatProtectionSettings/index.js" + }, + "require": { + "types": "./dist/commonjs/api/advancedThreatProtectionSettings/index.d.ts", + "default": "./dist/commonjs/api/advancedThreatProtectionSettings/index.js" + } + }, + "./api/replicas": { + "browser": { + "types": "./dist/browser/api/replicas/index.d.ts", + "default": "./dist/browser/api/replicas/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/replicas/index.d.ts", + "default": "./dist/react-native/api/replicas/index.js" + }, + "import": { + "types": "./dist/esm/api/replicas/index.d.ts", + "default": "./dist/esm/api/replicas/index.js" + }, + "require": { + "types": "./dist/commonjs/api/replicas/index.d.ts", + "default": "./dist/commonjs/api/replicas/index.js" + } + }, + "./api/backupsLongTermRetention": { + "browser": { + "types": "./dist/browser/api/backupsLongTermRetention/index.d.ts", + "default": "./dist/browser/api/backupsLongTermRetention/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/backupsLongTermRetention/index.d.ts", + "default": "./dist/react-native/api/backupsLongTermRetention/index.js" + }, + "import": { + "types": "./dist/esm/api/backupsLongTermRetention/index.d.ts", + "default": "./dist/esm/api/backupsLongTermRetention/index.js" + }, + "require": { + "types": "./dist/commonjs/api/backupsLongTermRetention/index.d.ts", + "default": "./dist/commonjs/api/backupsLongTermRetention/index.js" + } + }, + "./api/capturedLogs": { + "browser": { + "types": "./dist/browser/api/capturedLogs/index.d.ts", + "default": "./dist/browser/api/capturedLogs/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/capturedLogs/index.d.ts", + "default": "./dist/react-native/api/capturedLogs/index.js" + }, + "import": { + "types": "./dist/esm/api/capturedLogs/index.d.ts", + "default": "./dist/esm/api/capturedLogs/index.js" + }, + "require": { + "types": "./dist/commonjs/api/capturedLogs/index.d.ts", + "default": "./dist/commonjs/api/capturedLogs/index.js" + } + }, + "./api/capabilitiesByServer": { + "browser": { + "types": "./dist/browser/api/capabilitiesByServer/index.d.ts", + "default": "./dist/browser/api/capabilitiesByServer/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/capabilitiesByServer/index.d.ts", + "default": "./dist/react-native/api/capabilitiesByServer/index.js" + }, + "import": { + "types": "./dist/esm/api/capabilitiesByServer/index.d.ts", + "default": "./dist/esm/api/capabilitiesByServer/index.js" + }, + "require": { + "types": "./dist/commonjs/api/capabilitiesByServer/index.d.ts", + "default": "./dist/commonjs/api/capabilitiesByServer/index.js" + } + }, + "./api/administratorsMicrosoftEntra": { + "browser": { + "types": "./dist/browser/api/administratorsMicrosoftEntra/index.d.ts", + "default": "./dist/browser/api/administratorsMicrosoftEntra/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/administratorsMicrosoftEntra/index.d.ts", + "default": "./dist/react-native/api/administratorsMicrosoftEntra/index.js" + }, + "import": { + "types": "./dist/esm/api/administratorsMicrosoftEntra/index.d.ts", + "default": "./dist/esm/api/administratorsMicrosoftEntra/index.js" + }, + "require": { + "types": "./dist/commonjs/api/administratorsMicrosoftEntra/index.d.ts", + "default": "./dist/commonjs/api/administratorsMicrosoftEntra/index.js" + } + }, + "./api/virtualEndpoints": { + "browser": { + "types": "./dist/browser/api/virtualEndpoints/index.d.ts", + "default": "./dist/browser/api/virtualEndpoints/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/virtualEndpoints/index.d.ts", + "default": "./dist/react-native/api/virtualEndpoints/index.js" + }, + "import": { + "types": "./dist/esm/api/virtualEndpoints/index.d.ts", + "default": "./dist/esm/api/virtualEndpoints/index.js" + }, + "require": { + "types": "./dist/commonjs/api/virtualEndpoints/index.d.ts", + "default": "./dist/commonjs/api/virtualEndpoints/index.js" + } + }, + "./api/privateLinkResources": { + "browser": { + "types": "./dist/browser/api/privateLinkResources/index.d.ts", + "default": "./dist/browser/api/privateLinkResources/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/privateLinkResources/index.d.ts", + "default": "./dist/react-native/api/privateLinkResources/index.js" + }, + "import": { + "types": "./dist/esm/api/privateLinkResources/index.d.ts", + "default": "./dist/esm/api/privateLinkResources/index.js" + }, + "require": { + "types": "./dist/commonjs/api/privateLinkResources/index.d.ts", + "default": "./dist/commonjs/api/privateLinkResources/index.js" + } + }, + "./api/privateEndpointConnections": { + "browser": { + "types": "./dist/browser/api/privateEndpointConnections/index.d.ts", + "default": "./dist/browser/api/privateEndpointConnections/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/privateEndpointConnections/index.d.ts", + "default": "./dist/react-native/api/privateEndpointConnections/index.js" + }, + "import": { + "types": "./dist/esm/api/privateEndpointConnections/index.d.ts", + "default": "./dist/esm/api/privateEndpointConnections/index.js" + }, + "require": { + "types": "./dist/commonjs/api/privateEndpointConnections/index.d.ts", + "default": "./dist/commonjs/api/privateEndpointConnections/index.js" + } + }, + "./api/firewallRules": { + "browser": { + "types": "./dist/browser/api/firewallRules/index.d.ts", + "default": "./dist/browser/api/firewallRules/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/firewallRules/index.d.ts", + "default": "./dist/react-native/api/firewallRules/index.js" + }, + "import": { + "types": "./dist/esm/api/firewallRules/index.d.ts", + "default": "./dist/esm/api/firewallRules/index.js" + }, + "require": { + "types": "./dist/commonjs/api/firewallRules/index.d.ts", + "default": "./dist/commonjs/api/firewallRules/index.js" + } + }, + "./api/databases": { + "browser": { + "types": "./dist/browser/api/databases/index.d.ts", + "default": "./dist/browser/api/databases/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/databases/index.d.ts", + "default": "./dist/react-native/api/databases/index.js" + }, + "import": { + "types": "./dist/esm/api/databases/index.d.ts", + "default": "./dist/esm/api/databases/index.js" + }, + "require": { + "types": "./dist/commonjs/api/databases/index.d.ts", + "default": "./dist/commonjs/api/databases/index.js" + } + }, + "./api/configurations": { + "browser": { + "types": "./dist/browser/api/configurations/index.d.ts", + "default": "./dist/browser/api/configurations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/configurations/index.d.ts", + "default": "./dist/react-native/api/configurations/index.js" + }, + "import": { + "types": "./dist/esm/api/configurations/index.d.ts", + "default": "./dist/esm/api/configurations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/configurations/index.d.ts", + "default": "./dist/commonjs/api/configurations/index.js" + } + }, + "./api/servers": { + "browser": { + "types": "./dist/browser/api/servers/index.d.ts", + "default": "./dist/browser/api/servers/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/servers/index.d.ts", + "default": "./dist/react-native/api/servers/index.js" + }, + "import": { + "types": "./dist/esm/api/servers/index.d.ts", + "default": "./dist/esm/api/servers/index.js" + }, + "require": { + "types": "./dist/commonjs/api/servers/index.d.ts", + "default": "./dist/commonjs/api/servers/index.js" + } + }, + "./api/migrations": { + "browser": { + "types": "./dist/browser/api/migrations/index.d.ts", + "default": "./dist/browser/api/migrations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/migrations/index.d.ts", + "default": "./dist/react-native/api/migrations/index.js" + }, + "import": { + "types": "./dist/esm/api/migrations/index.d.ts", + "default": "./dist/esm/api/migrations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/migrations/index.d.ts", + "default": "./dist/commonjs/api/migrations/index.js" + } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/operations/index.d.ts", + "default": "./dist/react-native/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } } - } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-administratorsMicrosoftEntra-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-administratorsMicrosoftEntra-node.api.md new file mode 100644 index 000000000000..2048a331247c --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-administratorsMicrosoftEntra-node.api.md @@ -0,0 +1,44 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, objectId: string, options?: AdministratorsMicrosoftEntraDeleteOptionalParams): PollerLike, void>; + +// @public +export interface AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface AdministratorsMicrosoftEntraDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface AdministratorsMicrosoftEntraGetOptionalParams extends OperationOptions { +} + +// @public +export interface AdministratorsMicrosoftEntraListByServerOptionalParams extends OperationOptions { +} + +// @public +export function createOrUpdate(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, objectId: string, parameters: AdministratorMicrosoftEntraAdd, options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams): PollerLike, AdministratorMicrosoftEntra>; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, objectId: string, options?: AdministratorsMicrosoftEntraGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: AdministratorsMicrosoftEntraListByServerOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-advancedThreatProtectionSettings-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-advancedThreatProtectionSettings-node.api.md new file mode 100644 index 000000000000..1ebd19042f2d --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-advancedThreatProtectionSettings-node.api.md @@ -0,0 +1,26 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export interface AdvancedThreatProtectionSettingsGetOptionalParams extends OperationOptions { +} + +// @public +export interface AdvancedThreatProtectionSettingsListByServerOptionalParams extends OperationOptions { +} + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, threatProtectionName: ThreatProtectionName, options?: AdvancedThreatProtectionSettingsGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: AdvancedThreatProtectionSettingsListByServerOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-backupsAutomaticAndOnDemand-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-backupsAutomaticAndOnDemand-node.api.md new file mode 100644 index 000000000000..5f28125a1026 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-backupsAutomaticAndOnDemand-node.api.md @@ -0,0 +1,44 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandDeleteOptionalParams): PollerLike, void>; + +// @public +export interface BackupsAutomaticAndOnDemandCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface BackupsAutomaticAndOnDemandDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface BackupsAutomaticAndOnDemandGetOptionalParams extends OperationOptions { +} + +// @public +export interface BackupsAutomaticAndOnDemandListByServerOptionalParams extends OperationOptions { +} + +// @public +export function create(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandCreateOptionalParams): PollerLike, BackupAutomaticAndOnDemand>; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: BackupsAutomaticAndOnDemandListByServerOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-backupsLongTermRetention-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-backupsLongTermRetention-node.api.md new file mode 100644 index 000000000000..284d8f491ead --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-backupsLongTermRetention-node.api.md @@ -0,0 +1,43 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export interface BackupsLongTermRetentionCheckPrerequisitesOptionalParams extends OperationOptions { +} + +// @public +export interface BackupsLongTermRetentionGetOptionalParams extends OperationOptions { +} + +// @public +export interface BackupsLongTermRetentionListByServerOptionalParams extends OperationOptions { +} + +// @public +export interface BackupsLongTermRetentionStartOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function checkPrerequisites(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, parameters: LtrPreBackupRequest, options?: BackupsLongTermRetentionCheckPrerequisitesOptionalParams): Promise; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, backupName: string, options?: BackupsLongTermRetentionGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: BackupsLongTermRetentionListByServerOptionalParams): PagedAsyncIterableIterator; + +// @public +export function start(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, parameters: BackupsLongTermRetentionRequest, options?: BackupsLongTermRetentionStartOptionalParams): PollerLike, BackupsLongTermRetentionResponse>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-capabilitiesByLocation-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-capabilitiesByLocation-node.api.md new file mode 100644 index 000000000000..4c712e4628da --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-capabilitiesByLocation-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export interface CapabilitiesByLocationListOptionalParams extends OperationOptions { +} + +// @public +export function list(context: PostgreSQLManagementFlexibleServerContext, locationName: string, options?: CapabilitiesByLocationListOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-capabilitiesByServer-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-capabilitiesByServer-node.api.md new file mode 100644 index 000000000000..f0aba35b56d0 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-capabilitiesByServer-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export interface CapabilitiesByServerListOptionalParams extends OperationOptions { +} + +// @public +export function list(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: CapabilitiesByServerListOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-capturedLogs-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-capturedLogs-node.api.md new file mode 100644 index 000000000000..310bab54ee11 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-capturedLogs-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export interface CapturedLogsListByServerOptionalParams extends OperationOptions { +} + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: CapturedLogsListByServerOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-configurations-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-configurations-node.api.md new file mode 100644 index 000000000000..5e5bc70a5fa8 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-configurations-node.api.md @@ -0,0 +1,44 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export interface ConfigurationsGetOptionalParams extends OperationOptions { +} + +// @public +export interface ConfigurationsListByServerOptionalParams extends OperationOptions { +} + +// @public +export interface ConfigurationsPutOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ConfigurationsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, configurationName: string, options?: ConfigurationsGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: ConfigurationsListByServerOptionalParams): PagedAsyncIterableIterator; + +// @public +export function put(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsPutOptionalParams): PollerLike, Configuration>; + +// @public +export function update(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsUpdateOptionalParams): PollerLike, Configuration>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-databases-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-databases-node.api.md new file mode 100644 index 000000000000..f5ef4bd9cc40 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-databases-node.api.md @@ -0,0 +1,44 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, databaseName: string, options?: DatabasesDeleteOptionalParams): PollerLike, void>; + +// @public +export function create(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, databaseName: string, parameters: Database, options?: DatabasesCreateOptionalParams): PollerLike, Database>; + +// @public +export interface DatabasesCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DatabasesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DatabasesGetOptionalParams extends OperationOptions { +} + +// @public +export interface DatabasesListByServerOptionalParams extends OperationOptions { +} + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, databaseName: string, options?: DatabasesGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: DatabasesListByServerOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-firewallRules-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-firewallRules-node.api.md new file mode 100644 index 000000000000..79f8b074ab12 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-firewallRules-node.api.md @@ -0,0 +1,44 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams): PollerLike, FirewallRule>; + +// @public +export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface FirewallRulesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface FirewallRulesGetOptionalParams extends OperationOptions { +} + +// @public +export interface FirewallRulesListByServerOptionalParams extends OperationOptions { +} + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: FirewallRulesListByServerOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-migrations-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-migrations-node.api.md new file mode 100644 index 000000000000..ea5104b0305c --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-migrations-node.api.md @@ -0,0 +1,55 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function cancel(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, migrationName: string, options?: MigrationsCancelOptionalParams): Promise; + +// @public +export function checkNameAvailability(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, parameters: MigrationNameAvailability, options?: MigrationsCheckNameAvailabilityOptionalParams): Promise; + +// @public +export function create(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, migrationName: string, parameters: Migration, options?: MigrationsCreateOptionalParams): Promise; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, migrationName: string, options?: MigrationsGetOptionalParams): Promise; + +// @public +export function listByTargetServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: MigrationsListByTargetServerOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface MigrationsCancelOptionalParams extends OperationOptions { +} + +// @public +export interface MigrationsCheckNameAvailabilityOptionalParams extends OperationOptions { +} + +// @public +export interface MigrationsCreateOptionalParams extends OperationOptions { +} + +// @public +export interface MigrationsGetOptionalParams extends OperationOptions { +} + +// @public +export interface MigrationsListByTargetServerOptionalParams extends OperationOptions { + migrationListFilter?: MigrationListFilter; +} + +// @public +export interface MigrationsUpdateOptionalParams extends OperationOptions { +} + +// @public +export function update(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, migrationName: string, parameters: MigrationResourceForPatch, options?: MigrationsUpdateOptionalParams): Promise; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-nameAvailability-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-nameAvailability-node.api.md new file mode 100644 index 000000000000..75bbabff9bbd --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-nameAvailability-node.api.md @@ -0,0 +1,26 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function checkGlobally(context: PostgreSQLManagementFlexibleServerContext, parameters: CheckNameAvailabilityRequest, options?: NameAvailabilityCheckGloballyOptionalParams): Promise; + +// @public +export function checkWithLocation(context: PostgreSQLManagementFlexibleServerContext, locationName: string, parameters: CheckNameAvailabilityRequest, options?: NameAvailabilityCheckWithLocationOptionalParams): Promise; + +// @public +export interface NameAvailabilityCheckGloballyOptionalParams extends OperationOptions { +} + +// @public +export interface NameAvailabilityCheckWithLocationOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-node.api.md new file mode 100644 index 000000000000..4191ab73dcda --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-node.api.md @@ -0,0 +1,28 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { TokenCredential } from '@azure/core-auth'; + +// @public +export function createPostgreSQLManagementFlexibleServer(credential: TokenCredential, subscriptionId: string, options?: PostgreSQLManagementFlexibleServerClientOptionalParams): PostgreSQLManagementFlexibleServerContext; + +// @public +export interface PostgreSQLManagementFlexibleServerClientOptionalParams extends ClientOptions { + apiVersion?: string; + cloudSetting?: AzureSupportedClouds; +} + +// @public +export interface PostgreSQLManagementFlexibleServerContext extends Client { + apiVersion?: string; + subscriptionId: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-operations-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-operations-node.api.md new file mode 100644 index 000000000000..88fc210d8884 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-operations-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function list(context: PostgreSQLManagementFlexibleServerContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface OperationsListOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-privateDnsZoneSuffix-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-privateDnsZoneSuffix-node.api.md new file mode 100644 index 000000000000..7ef7e817c894 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-privateDnsZoneSuffix-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, options?: PrivateDnsZoneSuffixGetOptionalParams): Promise; + +// @public +export interface PrivateDnsZoneSuffixGetOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-privateEndpointConnections-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-privateEndpointConnections-node.api.md new file mode 100644 index 000000000000..3ab1a36545ca --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-privateEndpointConnections-node.api.md @@ -0,0 +1,44 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): PollerLike, void>; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: PrivateEndpointConnectionsListByServerOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { +} + +// @public +export interface PrivateEndpointConnectionsListByServerOptionalParams extends OperationOptions { +} + +// @public +export interface PrivateEndpointConnectionsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function update(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, parameters: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams): PollerLike, PrivateEndpointConnection>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-privateLinkResources-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-privateLinkResources-node.api.md new file mode 100644 index 000000000000..1bb3da195e57 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-privateLinkResources-node.api.md @@ -0,0 +1,26 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, groupName: string, options?: PrivateLinkResourcesGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: PrivateLinkResourcesListByServerOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface PrivateLinkResourcesGetOptionalParams extends OperationOptions { +} + +// @public +export interface PrivateLinkResourcesListByServerOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-quotaUsages-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-quotaUsages-node.api.md new file mode 100644 index 000000000000..c2527048aa65 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-quotaUsages-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function list(context: PostgreSQLManagementFlexibleServerContext, locationName: string, options?: QuotaUsagesListOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface QuotaUsagesListOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-replicas-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-replicas-node.api.md new file mode 100644 index 000000000000..92d33c03425e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-replicas-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: ReplicasListByServerOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface ReplicasListByServerOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-serverThreatProtectionSettings-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-serverThreatProtectionSettings-node.api.md new file mode 100644 index 000000000000..7c5060af980c --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-serverThreatProtectionSettings-node.api.md @@ -0,0 +1,22 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function createOrUpdate(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, threatProtectionName: ThreatProtectionName, parameters: AdvancedThreatProtectionSettingsModel, options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams): PollerLike, AdvancedThreatProtectionSettingsModel>; + +// @public +export interface ServerThreatProtectionSettingsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-servers-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-servers-node.api.md new file mode 100644 index 000000000000..206a726b6a28 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-servers-node.api.md @@ -0,0 +1,92 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: ServersDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, parameters: Server, options?: ServersCreateOrUpdateOptionalParams): PollerLike, Server>; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: ServersGetOptionalParams): Promise; + +// @public +export function listByResourceGroup(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, options?: ServersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listBySubscription(context: PostgreSQLManagementFlexibleServerContext, options?: ServersListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + +// @public +export function migrateNetworkMode(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: ServersMigrateNetworkModeOptionalParams): PollerLike, MigrateNetworkStatus>; + +// @public +export function restart(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: ServersRestartOptionalParams): PollerLike, void>; + +// @public +export interface ServersCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ServersDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ServersGetOptionalParams extends OperationOptions { +} + +// @public +export interface ServersListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface ServersListBySubscriptionOptionalParams extends OperationOptions { +} + +// @public +export interface ServersMigrateNetworkModeOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ServersRestartOptionalParams extends OperationOptions { + parameters?: RestartParameter; + updateIntervalInMs?: number; +} + +// @public +export interface ServersStartOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ServersStopOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ServersUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function start(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: ServersStartOptionalParams): PollerLike, void>; + +// @public +export function stop(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: ServersStopOptionalParams): PollerLike, void>; + +// @public +export function update(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, parameters: ServerForPatch, options?: ServersUpdateOptionalParams): PollerLike, Server>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-tuningOptions-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-tuningOptions-node.api.md new file mode 100644 index 000000000000..7064571154b3 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-tuningOptions-node.api.md @@ -0,0 +1,34 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, tuningOption: TuningOptionParameterEnum, options?: TuningOptionsGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: TuningOptionsListByServerOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listRecommendations(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, tuningOption: TuningOptionParameterEnum, options?: TuningOptionsListRecommendationsOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface TuningOptionsGetOptionalParams extends OperationOptions { +} + +// @public +export interface TuningOptionsListByServerOptionalParams extends OperationOptions { +} + +// @public +export interface TuningOptionsListRecommendationsOptionalParams extends OperationOptions { + recommendationType?: RecommendationTypeParameterEnum; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-virtualEndpoints-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-virtualEndpoints-node.api.md new file mode 100644 index 000000000000..84dcb1f3defb --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-virtualEndpoints-node.api.md @@ -0,0 +1,52 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, virtualEndpointName: string, options?: VirtualEndpointsDeleteOptionalParams): PollerLike, void>; + +// @public +export function create(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpoint, options?: VirtualEndpointsCreateOptionalParams): PollerLike, VirtualEndpoint>; + +// @public +export function get(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, virtualEndpointName: string, options?: VirtualEndpointsGetOptionalParams): Promise; + +// @public +export function listByServer(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, options?: VirtualEndpointsListByServerOptionalParams): PagedAsyncIterableIterator; + +// @public +export function update(context: PostgreSQLManagementFlexibleServerContext, resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpointResourceForPatch, options?: VirtualEndpointsUpdateOptionalParams): PollerLike, VirtualEndpoint>; + +// @public +export interface VirtualEndpointsCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface VirtualEndpointsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface VirtualEndpointsGetOptionalParams extends OperationOptions { +} + +// @public +export interface VirtualEndpointsListByServerOptionalParams extends OperationOptions { +} + +// @public +export interface VirtualEndpointsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-virtualNetworkSubnetUsage-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-virtualNetworkSubnetUsage-node.api.md new file mode 100644 index 000000000000..67306c48dddd --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-api-virtualNetworkSubnetUsage-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function list(context: PostgreSQLManagementFlexibleServerContext, locationName: string, parameters: VirtualNetworkSubnetUsageParameter, options?: VirtualNetworkSubnetUsageListOptionalParams): Promise; + +// @public +export interface VirtualNetworkSubnetUsageListOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-models-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-models-node.api.md new file mode 100644 index 000000000000..fac4568d2009 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-models-node.api.md @@ -0,0 +1,1739 @@ +## API Report File for "@azure/arm-postgresql-flexible" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public +export interface AdminCredentials { + sourceServerPassword: string; + targetServerPassword: string; +} + +// @public +export interface AdminCredentialsForPatch { + sourceServerPassword?: string; + targetServerPassword?: string; +} + +// @public +export interface AdministratorMicrosoftEntra extends ProxyResource { + objectId?: string; + principalName?: string; + principalType?: PrincipalType; + tenantId?: string; +} + +// @public +export interface AdministratorMicrosoftEntraAdd { + principalName?: string; + principalType?: PrincipalType; + tenantId?: string; +} + +// @public +export interface AdministratorMicrosoftEntraProperties { + objectId?: string; + principalName?: string; + principalType?: PrincipalType; + tenantId?: string; +} + +// @public +export interface AdministratorMicrosoftEntraPropertiesForAdd { + principalName?: string; + principalType?: PrincipalType; + tenantId?: string; +} + +// @public +export interface AdvancedThreatProtectionSettingsModel extends ProxyResource { + readonly creationTime?: Date; + state?: ThreatProtectionState; +} + +// @public +export interface AdvancedThreatProtectionSettingsProperties { + readonly creationTime?: Date; + state: ThreatProtectionState; +} + +// @public +export interface AuthConfig { + activeDirectoryAuth?: MicrosoftEntraAuth; + passwordAuth?: PasswordBasedAuth; + tenantId?: string; +} + +// @public +export interface AuthConfigForPatch { + activeDirectoryAuth?: MicrosoftEntraAuth; + passwordAuth?: PasswordBasedAuth; + tenantId?: string; +} + +// @public +export type AzureManagedDiskPerformanceTier = string; + +// @public +export interface Backup { + backupRetentionDays?: number; + readonly earliestRestoreDate?: Date; + geoRedundantBackup?: GeographicallyRedundantBackup; +} + +// @public +export interface BackupAutomaticAndOnDemand extends ProxyResource { + backupType?: BackupType; + completedTime?: Date; + source?: string; +} + +// @public +export interface BackupAutomaticAndOnDemandProperties { + backupType?: BackupType; + completedTime?: Date; + source?: string; +} + +// @public +export interface BackupForPatch { + backupRetentionDays?: number; + readonly earliestRestoreDate?: Date; + readonly geoRedundantBackup?: GeographicallyRedundantBackup; +} + +// @public +export interface BackupRequestBase { + backupSettings: BackupSettings; +} + +// @public +export interface BackupSettings { + backupName: string; +} + +// @public +export interface BackupsLongTermRetentionOperation extends ProxyResource { + backupMetadata?: string; + backupName?: string; + datasourceSizeInBytes?: number; + dataTransferredInBytes?: number; + endTime?: Date; + readonly errorCode?: string; + readonly errorMessage?: string; + percentComplete?: number; + startTime?: Date; + status?: ExecutionStatus; +} + +// @public +export interface BackupsLongTermRetentionRequest extends BackupRequestBase { + targetDetails: BackupStoreDetails; +} + +// @public +export interface BackupsLongTermRetentionResponse { + backupMetadata?: string; + backupName?: string; + datasourceSizeInBytes?: number; + dataTransferredInBytes?: number; + endTime?: Date; + readonly errorCode?: string; + readonly errorMessage?: string; + percentComplete?: number; + startTime?: Date; + status?: ExecutionStatus; +} + +// @public +export interface BackupsLongTermRetentionResponseProperties { + numberOfContainers: number; +} + +// @public +export interface BackupStoreDetails { + sasUriList: string[]; +} + +// @public +export type BackupType = string; + +// @public +export type Cancel = string; + +// @public +export interface Capability extends CapabilityBase { + readonly fastProvisioningSupported?: FastProvisioningSupport; + readonly geoBackupSupported?: GeographicallyRedundantBackupSupport; + name?: string; + readonly onlineResizeSupported?: OnlineStorageResizeSupport; + readonly restricted?: LocationRestricted; + readonly storageAutoGrowthSupported?: StorageAutoGrowthSupport; + readonly supportedFastProvisioningEditions?: FastProvisioningEditionCapability[]; + readonly supportedFeatures?: SupportedFeature[]; + readonly supportedServerEditions?: ServerEditionCapability[]; + readonly supportedServerVersions?: ServerVersionCapability[]; + readonly zoneRedundantHaAndGeoBackupSupported?: ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport; + readonly zoneRedundantHaSupported?: ZoneRedundantHighAvailabilitySupport; +} + +// @public +export interface CapabilityBase { + readonly reason?: string; + readonly status?: CapabilityStatus; +} + +// @public +export type CapabilityStatus = "Visible" | "Available" | "Default" | "Disabled"; + +// @public +export interface CapturedLog extends ProxyResource { + createdTime?: Date; + lastModifiedTime?: Date; + sizeInKb?: number; + typePropertiesType?: string; + url?: string; +} + +// @public +export interface CapturedLogProperties { + createdTime?: Date; + lastModifiedTime?: Date; + sizeInKb?: number; + type?: string; + url?: string; +} + +// @public +export type CheckNameAvailabilityReason = string; + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: CheckNameAvailabilityReason; +} + +// @public +export interface Cluster { + clusterSize?: number; + defaultDatabaseName?: string; +} + +// @public +export interface Configuration extends ProxyResource { + readonly allowedValues?: string; + readonly dataType?: ConfigurationDataType; + readonly defaultValue?: string; + readonly description?: string; + readonly documentationLink?: string; + readonly isConfigPendingRestart?: boolean; + readonly isDynamicConfig?: boolean; + readonly isReadOnly?: boolean; + source?: string; + readonly unit?: string; + value?: string; +} + +// @public +export type ConfigurationDataType = string; + +// @public +export interface ConfigurationForUpdate { + readonly allowedValues?: string; + readonly dataType?: ConfigurationDataType; + readonly defaultValue?: string; + readonly description?: string; + readonly documentationLink?: string; + readonly isConfigPendingRestart?: boolean; + readonly isDynamicConfig?: boolean; + readonly isReadOnly?: boolean; + source?: string; + readonly unit?: string; + value?: string; +} + +// @public +export interface ConfigurationProperties { + readonly allowedValues?: string; + readonly dataType?: ConfigurationDataType; + readonly defaultValue?: string; + readonly description?: string; + readonly documentationLink?: string; + readonly isConfigPendingRestart?: boolean; + readonly isDynamicConfig?: boolean; + readonly isReadOnly?: boolean; + source?: string; + readonly unit?: string; + value?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export type CreateMode = string; + +// @public +export type CreateModeForPatch = string; + +// @public +export interface Database extends ProxyResource { + charset?: string; + collation?: string; +} + +// @public +export interface DatabaseMigrationState { + appliedChanges?: number; + cdcDeleteCounter?: number; + cdcInsertCounter?: number; + cdcUpdateCounter?: number; + databaseName?: string; + endedOn?: Date; + fullLoadCompletedTables?: number; + fullLoadErroredTables?: number; + fullLoadLoadingTables?: number; + fullLoadQueuedTables?: number; + incomingChanges?: number; + latency?: number; + message?: string; + migrationOperation?: string; + migrationState?: MigrationDatabaseState; + startedOn?: Date; +} + +// @public +export interface DatabaseProperties { + charset?: string; + collation?: string; +} + +// @public +export interface DataEncryption { + readonly geoBackupEncryptionKeyStatus?: EncryptionKeyStatus; + geoBackupKeyURI?: string; + geoBackupUserAssignedIdentityId?: string; + readonly primaryEncryptionKeyStatus?: EncryptionKeyStatus; + primaryKeyURI?: string; + primaryUserAssignedIdentityId?: string; + type?: DataEncryptionType; +} + +// @public +export type DataEncryptionType = string; + +// @public +export interface DbLevelValidationStatus { + databaseName?: string; + endedOn?: Date; + startedOn?: Date; + summary?: ValidationSummaryItem[]; +} + +// @public +export interface DbServerMetadata { + readonly location?: string; + sku?: ServerSku; + storageMb?: number; + version?: string; +} + +// @public +export interface DelegatedSubnetUsage { + readonly subnetName?: string; + readonly usage?: number; +} + +// @public +export type EncryptionKeyStatus = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: any; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export type ExecutionStatus = string; + +// @public +export type FailoverMode = string; + +// @public +export interface FastProvisioningEditionCapability extends CapabilityBase { + readonly serverCount?: number; + readonly supportedServerVersions?: string; + readonly supportedSku?: string; + readonly supportedStorageGb?: number; + readonly supportedTier?: string; +} + +// @public +export type FastProvisioningSupport = string; + +// @public +export type FeatureStatus = string; + +// @public +export interface FirewallRule extends ProxyResource { + endIpAddress: string; + startIpAddress: string; +} + +// @public +export interface FirewallRuleProperties { + endIpAddress: string; + startIpAddress: string; +} + +// @public +export type GeographicallyRedundantBackup = string; + +// @public +export type GeographicallyRedundantBackupSupport = string; + +// @public +export interface HighAvailability { + mode?: PostgreSqlFlexibleServerHighAvailabilityMode; + standbyAvailabilityZone?: string; + readonly state?: HighAvailabilityState; +} + +// @public +export interface HighAvailabilityForPatch { + mode?: PostgreSqlFlexibleServerHighAvailabilityMode; + standbyAvailabilityZone?: string; + readonly state?: HighAvailabilityState; +} + +// @public +export type HighAvailabilityMode = string; + +// @public +export type HighAvailabilityState = string; + +// @public +export type IdentityType = string; + +// @public +export interface ImpactRecord { + absoluteValue?: number; + dimensionName?: string; + queryId?: number; + unit?: string; +} + +// @public +export enum KnownAzureManagedDiskPerformanceTier { + P1 = "P1", + P10 = "P10", + P15 = "P15", + P2 = "P2", + P20 = "P20", + P3 = "P3", + P30 = "P30", + P4 = "P4", + P40 = "P40", + P50 = "P50", + P6 = "P6", + P60 = "P60", + P70 = "P70", + P80 = "P80" +} + +// @public +export enum KnownBackupType { + CustomerOnDemand = "Customer On-Demand", + Full = "Full" +} + +// @public +export enum KnownCancel { + False = "False", + True = "True" +} + +// @public +export enum KnownCheckNameAvailabilityReason { + AlreadyExists = "AlreadyExists", + Invalid = "Invalid" +} + +// @public +export enum KnownConfigurationDataType { + Boolean = "Boolean", + Enumeration = "Enumeration", + Integer = "Integer", + Numeric = "Numeric", + Set = "Set", + String = "String" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownCreateMode { + Create = "Create", + Default = "Default", + GeoRestore = "GeoRestore", + PointInTimeRestore = "PointInTimeRestore", + Replica = "Replica", + ReviveDropped = "ReviveDropped", + Update = "Update" +} + +// @public +export enum KnownCreateModeForPatch { + Default = "Default", + Update = "Update" +} + +// @public +export enum KnownDataEncryptionType { + AzureKeyVault = "AzureKeyVault", + SystemManaged = "SystemManaged" +} + +// @public +export enum KnownEncryptionKeyStatus { + Invalid = "Invalid", + Valid = "Valid" +} + +// @public +export enum KnownExecutionStatus { + Cancelled = "Cancelled", + Failed = "Failed", + Running = "Running", + Succeeded = "Succeeded" +} + +// @public +export enum KnownFailoverMode { + ForcedFailover = "ForcedFailover", + ForcedSwitchover = "ForcedSwitchover", + PlannedFailover = "PlannedFailover", + PlannedSwitchover = "PlannedSwitchover" +} + +// @public +export enum KnownFastProvisioningSupport { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownFeatureStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownGeographicallyRedundantBackup { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownGeographicallyRedundantBackupSupport { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownHighAvailabilityMode { + SameZone = "SameZone", + ZoneRedundant = "ZoneRedundant" +} + +// @public +export enum KnownHighAvailabilityState { + CreatingStandby = "CreatingStandby", + FailingOver = "FailingOver", + Healthy = "Healthy", + NotEnabled = "NotEnabled", + RemovingStandby = "RemovingStandby", + ReplicatingData = "ReplicatingData" +} + +// @public +export enum KnownIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned", + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownLocationRestricted { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownLogicalReplicationOnSourceServer { + False = "False", + True = "True" +} + +// @public +export enum KnownMicrosoftEntraAuth { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownMigrateRolesAndPermissions { + False = "False", + True = "True" +} + +// @public +export enum KnownMigrationDatabaseState { + Canceled = "Canceled", + Canceling = "Canceling", + Failed = "Failed", + InProgress = "InProgress", + Succeeded = "Succeeded", + WaitingForCutoverTrigger = "WaitingForCutoverTrigger" +} + +// @public +export enum KnownMigrationListFilter { + Active = "Active", + All = "All" +} + +// @public +export enum KnownMigrationMode { + Offline = "Offline", + Online = "Online" +} + +// @public +export enum KnownMigrationNameAvailabilityReason { + AlreadyExists = "AlreadyExists", + Invalid = "Invalid" +} + +// @public +export enum KnownMigrationOption { + Migrate = "Migrate", + Validate = "Validate", + ValidateAndMigrate = "ValidateAndMigrate" +} + +// @public +export enum KnownMigrationState { + Canceled = "Canceled", + CleaningUp = "CleaningUp", + Failed = "Failed", + InProgress = "InProgress", + Succeeded = "Succeeded", + ValidationFailed = "ValidationFailed", + WaitingForUserAction = "WaitingForUserAction" +} + +// @public +export enum KnownMigrationSubstate { + CancelingRequestedDBMigrations = "CancelingRequestedDBMigrations", + Completed = "Completed", + CompletingMigration = "CompletingMigration", + MigratingData = "MigratingData", + PerformingPreRequisiteSteps = "PerformingPreRequisiteSteps", + ValidationInProgress = "ValidationInProgress", + WaitingForCutoverTrigger = "WaitingForCutoverTrigger", + WaitingForDataMigrationScheduling = "WaitingForDataMigrationScheduling", + WaitingForDataMigrationWindow = "WaitingForDataMigrationWindow", + WaitingForDBsToMigrateSpecification = "WaitingForDBsToMigrateSpecification", + WaitingForLogicalReplicationSetupRequestOnSourceDB = "WaitingForLogicalReplicationSetupRequestOnSourceDB", + WaitingForTargetDBOverwriteConfirmation = "WaitingForTargetDBOverwriteConfirmation" +} + +// @public +export enum KnownNetworkMigrationState { + CancelInProgress = "CancelInProgress", + Cancelled = "Cancelled", + Failed = "Failed", + InProgress = "InProgress", + Pending = "Pending", + Succeeded = "Succeeded" +} + +// @public +export enum KnownOnlineStorageResizeSupport { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownOperationOrigin { + NotSpecified = "NotSpecified", + System = "system", + User = "user" +} + +// @public +export enum KnownOverwriteDatabasesOnTargetServer { + False = "False", + True = "True" +} + +// @public +export enum KnownPasswordBasedAuth { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownPostgresMajorVersion { + Eighteen = "18", + Eleven = "11", + Fifteen = "15", + Fourteen = "14", + Seventeen = "17", + Sixteen = "16", + Thirteen = "13", + Twelve = "12" +} + +// @public +export enum KnownPostgreSqlFlexibleServerHighAvailabilityMode { + Disabled = "Disabled", + SameZone = "SameZone", + ZoneRedundant = "ZoneRedundant" +} + +// @public +export enum KnownPrincipalType { + Group = "Group", + ServicePrincipal = "ServicePrincipal", + Unknown = "Unknown", + User = "User" +} + +// @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 KnownReadReplicaPromoteMode { + Standalone = "Standalone", + Switchover = "Switchover" +} + +// @public +export enum KnownReadReplicaPromoteOption { + Forced = "Forced", + Planned = "Planned" +} + +// @public +export enum KnownRecommendationTypeEnum { + AnalyzeTable = "AnalyzeTable", + CreateIndex = "CreateIndex", + DropIndex = "DropIndex", + ReIndex = "ReIndex", + VacuumTable = "VacuumTable" +} + +// @public +export enum KnownRecommendationTypeParameterEnum { + AnalyzeTable = "AnalyzeTable", + CreateIndex = "CreateIndex", + DropIndex = "DropIndex", + ReIndex = "ReIndex", + VacuumTable = "VacuumTable" +} + +// @public +export enum KnownReplicationRole { + AsyncReplica = "AsyncReplica", + GeoAsyncReplica = "GeoAsyncReplica", + None = "None", + Primary = "Primary" +} + +// @public +export enum KnownReplicationState { + Active = "Active", + Broken = "Broken", + Catchup = "Catchup", + Provisioning = "Provisioning", + Reconfiguring = "Reconfiguring", + Updating = "Updating" +} + +// @public +export enum KnownServerPublicNetworkAccessState { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownServerState { + Disabled = "Disabled", + Dropping = "Dropping", + Inaccessible = "Inaccessible", + Provisioning = "Provisioning", + Ready = "Ready", + Restarting = "Restarting", + Starting = "Starting", + Stopped = "Stopped", + Stopping = "Stopping", + Updating = "Updating" +} + +// @public +export enum KnownSkuTier { + Burstable = "Burstable", + GeneralPurpose = "GeneralPurpose", + MemoryOptimized = "MemoryOptimized" +} + +// @public +export enum KnownSourceType { + ApsaraDBRDS = "ApsaraDB_RDS", + AWS = "AWS", + AWSAurora = "AWS_AURORA", + AWSEC2 = "AWS_EC2", + AWSRDS = "AWS_RDS", + AzureVM = "AzureVM", + CrunchyPostgreSQL = "Crunchy_PostgreSQL", + DigitalOceanDroplets = "Digital_Ocean_Droplets", + DigitalOceanPostgreSQL = "Digital_Ocean_PostgreSQL", + EDB = "EDB", + EDBOracleServer = "EDB_Oracle_Server", + EDBPostgreSQL = "EDB_PostgreSQL", + GCP = "GCP", + GCPAlloyDB = "GCP_AlloyDB", + GCPCloudSQL = "GCP_CloudSQL", + GCPCompute = "GCP_Compute", + HerokuPostgreSQL = "Heroku_PostgreSQL", + HuaweiCompute = "Huawei_Compute", + HuaweiRDS = "Huawei_RDS", + OnPremises = "OnPremises", + PostgreSQLCosmosDB = "PostgreSQLCosmosDB", + PostgreSQLFlexibleServer = "PostgreSQLFlexibleServer", + PostgreSQLSingleServer = "PostgreSQLSingleServer", + SupabasePostgreSQL = "Supabase_PostgreSQL" +} + +// @public +export enum KnownSslMode { + Prefer = "Prefer", + Require = "Require", + VerifyCA = "VerifyCA", + VerifyFull = "VerifyFull" +} + +// @public +export enum KnownStartDataMigration { + False = "False", + True = "True" +} + +// @public +export enum KnownStorageAutoGrow { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownStorageAutoGrowthSupport { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownStorageType { + PremiumLRS = "Premium_LRS", + PremiumV2LRS = "PremiumV2_LRS", + UltraSSDLRS = "UltraSSD_LRS" +} + +// @public +export enum KnownThreatProtectionName { + Default = "Default" +} + +// @public +export enum KnownTriggerCutover { + False = "False", + True = "True" +} + +// @public +export enum KnownTuningOptionParameterEnum { + Index = "index", + Table = "table" +} + +// @public +export enum KnownValidationState { + Failed = "Failed", + Succeeded = "Succeeded", + Warning = "Warning" +} + +// @public +export enum KnownVersions { + V20250801 = "2025-08-01", + V20260101 = "2026-01-01-preview" +} + +// @public +export enum KnownVirtualEndpointType { + ReadWrite = "ReadWrite" +} + +// @public +export enum KnownZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownZoneRedundantHighAvailabilitySupport { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export type LocationRestricted = string; + +// @public +export type LogicalReplicationOnSourceServer = string; + +// @public +export interface LogSpecification { + blobDuration?: string; + displayName?: string; + name?: string; +} + +// @public +export interface LtrBackupOperationResponseProperties { + backupMetadata?: string; + backupName?: string; + datasourceSizeInBytes?: number; + dataTransferredInBytes?: number; + endTime?: Date; + readonly errorCode?: string; + readonly errorMessage?: string; + percentComplete?: number; + startTime: Date; + status: ExecutionStatus; +} + +// @public +export interface LtrPreBackupRequest extends BackupRequestBase { +} + +// @public +export interface LtrPreBackupResponse { + numberOfContainers: number; +} + +// @public +export interface MaintenanceWindow { + customWindow?: string; + dayOfWeek?: number; + startHour?: number; + startMinute?: number; +} + +// @public +export interface MaintenanceWindowForPatch { + customWindow?: string; + dayOfWeek?: number; + startHour?: number; + startMinute?: number; +} + +// @public +export interface MetricSpecification { + aggregationType?: string; + category?: string; + displayDescription?: string; + displayName?: string; + name?: string; + supportedAggregationTypes?: string[]; + supportedTimeGrainTypes?: string[]; + unit?: string; +} + +// @public +export type MicrosoftEntraAuth = string; + +// @public +export interface MigrateNetworkStatus { + resourceGroupName?: string; + serverName?: string; + readonly state?: NetworkMigrationState; + subscriptionId?: string; +} + +// @public +export type MigrateRolesAndPermissions = string; + +// @public +export interface Migration extends TrackedResource { + cancel?: Cancel; + readonly currentStatus?: MigrationStatus; + dbsToCancelMigrationOn?: string[]; + dbsToMigrate?: string[]; + dbsToTriggerCutoverOn?: string[]; + migrateRoles?: MigrateRolesAndPermissions; + readonly migrationId?: string; + migrationInstanceResourceId?: string; + migrationMode?: MigrationMode; + migrationOption?: MigrationOption; + migrationWindowEndTimeInUtc?: Date; + migrationWindowStartTimeInUtc?: Date; + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + secretParameters?: MigrationSecretParameters; + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + sourceDbServerFullyQualifiedDomainName?: string; + readonly sourceDbServerMetadata?: DbServerMetadata; + sourceDbServerResourceId?: string; + sourceType?: SourceType; + sslMode?: SslMode; + startDataMigration?: StartDataMigration; + targetDbServerFullyQualifiedDomainName?: string; + readonly targetDbServerMetadata?: DbServerMetadata; + readonly targetDbServerResourceId?: string; + triggerCutover?: TriggerCutover; +} + +// @public +export type MigrationDatabaseState = string; + +// @public +export type MigrationListFilter = string; + +// @public +export type MigrationMode = string; + +// @public +export interface MigrationNameAvailability { + readonly message?: string; + name: string; + readonly nameAvailable?: boolean; + readonly reason?: MigrationNameAvailabilityReason; + type: string; +} + +// @public +export type MigrationNameAvailabilityReason = string; + +// @public +export type MigrationOption = string; + +// @public +export interface MigrationProperties { + cancel?: Cancel; + readonly currentStatus?: MigrationStatus; + dbsToCancelMigrationOn?: string[]; + dbsToMigrate?: string[]; + dbsToTriggerCutoverOn?: string[]; + migrateRoles?: MigrateRolesAndPermissions; + readonly migrationId?: string; + migrationInstanceResourceId?: string; + migrationMode?: MigrationMode; + migrationOption?: MigrationOption; + migrationWindowEndTimeInUtc?: Date; + migrationWindowStartTimeInUtc?: Date; + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + secretParameters?: MigrationSecretParameters; + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + sourceDbServerFullyQualifiedDomainName?: string; + readonly sourceDbServerMetadata?: DbServerMetadata; + sourceDbServerResourceId?: string; + sourceType?: SourceType; + sslMode?: SslMode; + startDataMigration?: StartDataMigration; + targetDbServerFullyQualifiedDomainName?: string; + readonly targetDbServerMetadata?: DbServerMetadata; + readonly targetDbServerResourceId?: string; + triggerCutover?: TriggerCutover; +} + +// @public +export interface MigrationPropertiesForPatch { + cancel?: Cancel; + dbsToCancelMigrationOn?: string[]; + dbsToMigrate?: string[]; + dbsToTriggerCutoverOn?: string[]; + migrateRoles?: MigrateRolesAndPermissions; + migrationMode?: MigrationMode; + migrationWindowStartTimeInUtc?: Date; + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + secretParameters?: MigrationSecretParametersForPatch; + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + sourceDbServerFullyQualifiedDomainName?: string; + sourceDbServerResourceId?: string; + startDataMigration?: StartDataMigration; + targetDbServerFullyQualifiedDomainName?: string; + triggerCutover?: TriggerCutover; +} + +// @public +export interface MigrationResourceForPatch { + cancel?: Cancel; + dbsToCancelMigrationOn?: string[]; + dbsToMigrate?: string[]; + dbsToTriggerCutoverOn?: string[]; + migrateRoles?: MigrateRolesAndPermissions; + migrationMode?: MigrationMode; + migrationWindowStartTimeInUtc?: Date; + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + secretParameters?: MigrationSecretParametersForPatch; + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + sourceDbServerFullyQualifiedDomainName?: string; + sourceDbServerResourceId?: string; + startDataMigration?: StartDataMigration; + tags?: Record; + targetDbServerFullyQualifiedDomainName?: string; + triggerCutover?: TriggerCutover; +} + +// @public +export interface MigrationSecretParameters { + adminCredentials: AdminCredentials; + sourceServerUsername?: string; + targetServerUsername?: string; +} + +// @public +export interface MigrationSecretParametersForPatch { + adminCredentials?: AdminCredentialsForPatch; + sourceServerUsername?: string; + targetServerUsername?: string; +} + +// @public +export type MigrationState = string; + +// @public +export interface MigrationStatus { + readonly currentSubStateDetails?: MigrationSubstateDetails; + readonly error?: string; + readonly state?: MigrationState; +} + +// @public +export type MigrationSubstate = string; + +// @public +export interface MigrationSubstateDetails { + readonly currentSubState?: MigrationSubstate; + // (undocumented) + dbDetails?: Record; + // (undocumented) + validationDetails?: ValidationDetails; +} + +// @public +export interface NameAvailabilityModel extends CheckNameAvailabilityResponse { + readonly name?: string; + readonly type?: string; +} + +// @public +export interface NameProperty { + localizedValue?: string; + value?: string; +} + +// @public +export interface Network { + delegatedSubnetResourceId?: string; + privateDnsZoneArmResourceId?: string; + publicNetworkAccess?: ServerPublicNetworkAccessState; +} + +// @public +export type NetworkMigrationState = string; + +// @public +export interface ObjectRecommendation extends ProxyResource { + analyzedWorkload?: ObjectRecommendationPropertiesAnalyzedWorkload; + currentState?: string; + readonly details?: ObjectRecommendationDetails; + readonly estimatedImpact?: ImpactRecord[]; + implementationDetails?: ObjectRecommendationPropertiesImplementationDetails; + improvedQueryIds?: number[]; + initialRecommendedTime?: Date; + kind?: string; + lastRecommendedTime?: Date; + recommendationReason?: string; + recommendationType?: RecommendationTypeEnum; + timesRecommended?: number; +} + +// @public +export interface ObjectRecommendationDetails { + databaseName?: string; + includedColumns?: string[]; + indexColumns?: string[]; + indexName?: string; + indexType?: string; + schema?: string; + table?: string; +} + +// @public +export interface ObjectRecommendationProperties { + analyzedWorkload?: ObjectRecommendationPropertiesAnalyzedWorkload; + currentState?: string; + readonly details?: ObjectRecommendationDetails; + readonly estimatedImpact?: ImpactRecord[]; + implementationDetails?: ObjectRecommendationPropertiesImplementationDetails; + improvedQueryIds?: number[]; + initialRecommendedTime?: Date; + lastRecommendedTime?: Date; + recommendationReason?: string; + recommendationType?: RecommendationTypeEnum; + timesRecommended?: number; +} + +// @public +export interface ObjectRecommendationPropertiesAnalyzedWorkload { + endTime?: Date; + queryCount?: number; + startTime?: Date; +} + +// @public +export interface ObjectRecommendationPropertiesImplementationDetails { + method?: string; + script?: string; +} + +// @public +export type OnlineStorageResizeSupport = string; + +// @public +export interface Operation { + readonly display?: OperationDisplay; + isDataAction?: boolean; + readonly name?: string; + readonly origin?: OperationOrigin; + readonly properties?: OperationProperties; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export type OperationOrigin = string; + +// @public +export interface OperationProperties { + serviceSpecification?: ServiceSpecification; +} + +// @public +export type OverwriteDatabasesOnTargetServer = string; + +// @public +export type PasswordBasedAuth = string; + +// @public +export type PostgresMajorVersion = string; + +// @public +export type PostgreSqlFlexibleServerHighAvailabilityMode = string; + +// @public +export type PrincipalType = string; + +// @public (undocumented) +export type PrivateDnsZoneSuffixGetResponse = { + body: string; +}; + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export interface PrivateEndpointConnection extends Resource { + readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export interface PrivateEndpointConnectionProperties { + readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export type PrivateEndpointConnectionProvisioningState = string; + +// @public +export type PrivateEndpointServiceConnectionStatus = string; + +// @public +export interface PrivateLinkResource extends ProxyResource { + readonly groupId?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; +} + +// @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 ProxyResource extends Resource { +} + +// @public +export interface QuotaUsage { + currentValue?: number; + id?: string; + limit?: number; + name?: NameProperty; + unit?: string; +} + +// @public +export type ReadReplicaPromoteMode = string; + +// @public +export type ReadReplicaPromoteOption = string; + +// @public +export type RecommendationTypeEnum = string; + +// @public +export type RecommendationTypeParameterEnum = string; + +// @public +export interface Replica { + readonly capacity?: number; + promoteMode?: ReadReplicaPromoteMode; + promoteOption?: ReadReplicaPromoteOption; + readonly replicationState?: ReplicationState; + role?: ReplicationRole; +} + +// @public +export type ReplicationRole = string; + +// @public +export type ReplicationState = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface RestartParameter { + failoverMode?: FailoverMode; + restartWithFailover?: boolean; +} + +// @public +export interface Server extends TrackedResource { + administratorLogin?: string; + administratorLoginPassword?: string; + authConfig?: AuthConfig; + availabilityZone?: string; + backup?: Backup; + cluster?: Cluster; + createMode?: CreateMode; + dataEncryption?: DataEncryption; + readonly fullyQualifiedDomainName?: string; + highAvailability?: HighAvailability; + identity?: UserAssignedIdentity; + maintenanceWindow?: MaintenanceWindow; + readonly minorVersion?: string; + network?: Network; + pointInTimeUTC?: Date; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + replica?: Replica; + readonly replicaCapacity?: number; + replicationRole?: ReplicationRole; + sku?: Sku; + sourceServerResourceId?: string; + readonly state?: ServerState; + storage?: Storage; + version?: PostgresMajorVersion; +} + +// @public +export interface ServerEditionCapability extends CapabilityBase { + readonly defaultSkuName?: string; + readonly name?: string; + readonly supportedServerSkus?: ServerSkuCapability[]; + readonly supportedStorageEditions?: StorageEditionCapability[]; +} + +// @public +export interface ServerForPatch { + readonly administratorLogin?: string; + administratorLoginPassword?: string; + authConfig?: AuthConfigForPatch; + availabilityZone?: string; + backup?: BackupForPatch; + cluster?: Cluster; + createMode?: CreateModeForPatch; + dataEncryption?: DataEncryption; + highAvailability?: HighAvailabilityForPatch; + identity?: UserAssignedIdentity; + maintenanceWindow?: MaintenanceWindowForPatch; + network?: Network; + replica?: Replica; + replicationRole?: ReplicationRole; + sku?: SkuForPatch; + storage?: Storage; + tags?: Record; + version?: PostgresMajorVersion; +} + +// @public +export interface ServerProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + authConfig?: AuthConfig; + availabilityZone?: string; + backup?: Backup; + cluster?: Cluster; + createMode?: CreateMode; + dataEncryption?: DataEncryption; + readonly fullyQualifiedDomainName?: string; + highAvailability?: HighAvailability; + maintenanceWindow?: MaintenanceWindow; + readonly minorVersion?: string; + network?: Network; + pointInTimeUTC?: Date; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + replica?: Replica; + readonly replicaCapacity?: number; + replicationRole?: ReplicationRole; + sourceServerResourceId?: string; + readonly state?: ServerState; + storage?: Storage; + version?: PostgresMajorVersion; +} + +// @public +export interface ServerPropertiesForPatch { + readonly administratorLogin?: string; + administratorLoginPassword?: string; + authConfig?: AuthConfigForPatch; + availabilityZone?: string; + backup?: BackupForPatch; + cluster?: Cluster; + createMode?: CreateModeForPatch; + dataEncryption?: DataEncryption; + highAvailability?: HighAvailabilityForPatch; + maintenanceWindow?: MaintenanceWindowForPatch; + network?: Network; + replica?: Replica; + replicationRole?: ReplicationRole; + storage?: Storage; + version?: PostgresMajorVersion; +} + +// @public +export type ServerPublicNetworkAccessState = string; + +// @public +export interface ServerSku { + name?: string; + tier?: SkuTier; +} + +// @public +export interface ServerSkuCapability extends CapabilityBase { + readonly name?: string; + readonly securityProfile?: string; + readonly supportedFeatures?: SupportedFeature[]; + readonly supportedHaMode?: HighAvailabilityMode[]; + readonly supportedIops?: number; + readonly supportedMemoryPerVcoreMb?: number; + readonly supportedZones?: string[]; + readonly vCores?: number; +} + +// @public +export type ServerState = string; + +// @public +export interface ServerVersionCapability extends CapabilityBase { + readonly name?: string; + readonly supportedFeatures?: SupportedFeature[]; + readonly supportedVersionsToUpgrade?: string[]; +} + +// @public +export interface ServiceSpecification { + readonly logSpecifications?: LogSpecification[]; + readonly metricSpecifications?: MetricSpecification[]; +} + +// @public +export interface Sku { + name: string; + tier: SkuTier; +} + +// @public +export interface SkuForPatch { + name?: string; + tier?: SkuTier; +} + +// @public +export type SkuTier = string; + +// @public +export type SourceType = string; + +// @public +export type SslMode = string; + +// @public +export type StartDataMigration = string; + +// @public +export interface Storage { + autoGrow?: StorageAutoGrow; + iops?: number; + storageSizeGB?: number; + throughput?: number; + tier?: AzureManagedDiskPerformanceTier; + type?: StorageType; +} + +// @public +export type StorageAutoGrow = string; + +// @public +export type StorageAutoGrowthSupport = string; + +// @public +export interface StorageEditionCapability extends CapabilityBase { + readonly defaultStorageSizeMb?: number; + readonly name?: string; + readonly supportedStorageMb?: StorageMbCapability[]; +} + +// @public +export interface StorageMbCapability extends CapabilityBase { + readonly defaultIopsTier?: string; + readonly maximumStorageSizeMb?: number; + readonly storageSizeMb?: number; + readonly supportedIops?: number; + readonly supportedIopsTiers?: StorageTierCapability[]; + readonly supportedMaximumIops?: number; + readonly supportedMaximumThroughput?: number; + readonly supportedThroughput?: number; +} + +// @public +export interface StorageTierCapability extends CapabilityBase { + readonly iops?: number; + readonly name?: string; +} + +// @public +export type StorageType = string; + +// @public +export interface SupportedFeature { + readonly name?: string; + readonly status?: FeatureStatus; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type ThreatProtectionName = string; + +// @public +export type ThreatProtectionState = "Enabled" | "Disabled"; + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export type TriggerCutover = string; + +// @public +export type TuningOptionParameterEnum = string; + +// @public +export interface TuningOptions extends ProxyResource { + properties?: TuningOptionsProperties; +} + +// @public +export interface TuningOptionsProperties { + readonly state?: string; +} + +// @public +export interface UserAssignedIdentity { + principalId?: string; + readonly tenantId?: string; + type: IdentityType; + userAssignedIdentities?: Record; +} + +// @public +export interface UserIdentity { + clientId?: string; + principalId?: string; +} + +// @public +export interface ValidationDetails { + dbLevelValidationDetails?: DbLevelValidationStatus[]; + serverLevelValidationDetails?: ValidationSummaryItem[]; + status?: ValidationState; + validationEndTimeInUtc?: Date; + validationStartTimeInUtc?: Date; +} + +// @public +export interface ValidationMessage { + message?: string; + state?: ValidationState; +} + +// @public +export type ValidationState = string; + +// @public +export interface ValidationSummaryItem { + messages?: ValidationMessage[]; + state?: ValidationState; + type?: string; +} + +// @public +export interface VirtualEndpoint extends ProxyResource { + endpointType?: VirtualEndpointType; + members?: string[]; + readonly virtualEndpoints?: string[]; +} + +// @public +export interface VirtualEndpointResourceForPatch { + endpointType?: VirtualEndpointType; + members?: string[]; + readonly virtualEndpoints?: string[]; +} + +// @public +export interface VirtualEndpointResourceProperties { + endpointType?: VirtualEndpointType; + members?: string[]; + readonly virtualEndpoints?: string[]; +} + +// @public +export type VirtualEndpointType = string; + +// @public +export interface VirtualNetworkSubnetUsageModel { + // (undocumented) + readonly delegatedSubnetsUsage?: DelegatedSubnetUsage[]; + readonly location?: string; + readonly subscriptionId?: string; +} + +// @public +export interface VirtualNetworkSubnetUsageParameter { + virtualNetworkArmResourceId?: string; +} + +// @public +export type ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport = string; + +// @public +export type ZoneRedundantHighAvailabilitySupport = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-node.api.md b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-node.api.md index 70cf6a77cbf2..1720f0819fbd 100644 --- a/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-node.api.md +++ b/sdk/postgresql/arm-postgresql-flexible/review/arm-postgresql-flexible-node.api.md @@ -4,11 +4,15 @@ ```ts -import type * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { CancelOnProgress } from '@azure/core-lro'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; import type { OperationState } from '@azure/core-lro'; -import type { PagedAsyncIterableIterator } from '@azure/core-paging'; -import type { SimplePollerLike } from '@azure/core-lro'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { Pipeline } from '@azure/core-rest-pipeline'; +import type { PollerLike } from '@azure/core-lro'; +import type { TokenCredential } from '@azure/core-auth'; // @public export interface AdminCredentials { @@ -38,113 +42,78 @@ export interface AdministratorMicrosoftEntraAdd { } // @public -export interface AdministratorMicrosoftEntraList { - nextLink?: string; - value?: AdministratorMicrosoftEntra[]; -} - -// @public -export interface AdministratorsMicrosoftEntra { - beginCreateOrUpdate(resourceGroupName: string, serverName: string, objectId: string, parameters: AdministratorMicrosoftEntraAdd, options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams): Promise, AdministratorsMicrosoftEntraCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, serverName: string, objectId: string, parameters: AdministratorMicrosoftEntraAdd, options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, serverName: string, objectId: string, options?: AdministratorsMicrosoftEntraDeleteOptionalParams): Promise, AdministratorsMicrosoftEntraDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, serverName: string, objectId: string, options?: AdministratorsMicrosoftEntraDeleteOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, objectId: string, options?: AdministratorsMicrosoftEntraGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: AdministratorsMicrosoftEntraListByServerOptionalParams): PagedAsyncIterableIterator; +export interface AdministratorMicrosoftEntraProperties { + objectId?: string; + principalName?: string; + principalType?: PrincipalType; + tenantId?: string; } // @public -export interface AdministratorsMicrosoftEntraCreateOrUpdateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface AdministratorMicrosoftEntraPropertiesForAdd { + principalName?: string; + principalType?: PrincipalType; + tenantId?: string; } // @public -export interface AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type AdministratorsMicrosoftEntraCreateOrUpdateResponse = AdministratorMicrosoftEntra; - -// @public -export interface AdministratorsMicrosoftEntraDeleteHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface AdministratorsMicrosoftEntraDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface AdministratorsMicrosoftEntraDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type AdministratorsMicrosoftEntraDeleteResponse = AdministratorsMicrosoftEntraDeleteHeaders; - -// @public -export interface AdministratorsMicrosoftEntraGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type AdministratorsMicrosoftEntraGetResponse = AdministratorMicrosoftEntra; - -// @public -export interface AdministratorsMicrosoftEntraListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface AdministratorsMicrosoftEntraGetOptionalParams extends OperationOptions { } // @public -export type AdministratorsMicrosoftEntraListByServerNextResponse = AdministratorMicrosoftEntraList; - -// @public -export interface AdministratorsMicrosoftEntraListByServerOptionalParams extends coreClient.OperationOptions { +export interface AdministratorsMicrosoftEntraListByServerOptionalParams extends OperationOptions { } // @public -export type AdministratorsMicrosoftEntraListByServerResponse = AdministratorMicrosoftEntraList; - -// @public -export interface AdvancedThreatProtectionSettings { - get(resourceGroupName: string, serverName: string, threatProtectionName: ThreatProtectionName, options?: AdvancedThreatProtectionSettingsGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: AdvancedThreatProtectionSettingsListByServerOptionalParams): PagedAsyncIterableIterator; +export interface AdministratorsMicrosoftEntraOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, serverName: string, objectId: string, parameters: AdministratorMicrosoftEntraAdd, options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams) => Promise, AdministratorMicrosoftEntra>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, serverName: string, objectId: string, parameters: AdministratorMicrosoftEntraAdd, options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, serverName: string, objectId: string, options?: AdministratorsMicrosoftEntraDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, serverName: string, objectId: string, options?: AdministratorsMicrosoftEntraDeleteOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, serverName: string, objectId: string, parameters: AdministratorMicrosoftEntraAdd, options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams) => PollerLike, AdministratorMicrosoftEntra>; + delete: (resourceGroupName: string, serverName: string, objectId: string, options?: AdministratorsMicrosoftEntraDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, serverName: string, objectId: string, options?: AdministratorsMicrosoftEntraGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: AdministratorsMicrosoftEntraListByServerOptionalParams) => PagedAsyncIterableIterator; } // @public -export interface AdvancedThreatProtectionSettingsGetOptionalParams extends coreClient.OperationOptions { +export interface AdvancedThreatProtectionSettingsGetOptionalParams extends OperationOptions { } // @public -export type AdvancedThreatProtectionSettingsGetResponse = AdvancedThreatProtectionSettingsModel; - -// @public -export interface AdvancedThreatProtectionSettingsList { - nextLink?: string; - readonly value?: AdvancedThreatProtectionSettingsModel[]; +export interface AdvancedThreatProtectionSettingsListByServerOptionalParams extends OperationOptions { } // @public -export interface AdvancedThreatProtectionSettingsListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface AdvancedThreatProtectionSettingsModel extends ProxyResource { + readonly creationTime?: Date; + state?: ThreatProtectionState; } // @public -export type AdvancedThreatProtectionSettingsListByServerNextResponse = AdvancedThreatProtectionSettingsList; - -// @public -export interface AdvancedThreatProtectionSettingsListByServerOptionalParams extends coreClient.OperationOptions { +export interface AdvancedThreatProtectionSettingsOperations { + get: (resourceGroupName: string, serverName: string, threatProtectionName: ThreatProtectionName, options?: AdvancedThreatProtectionSettingsGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: AdvancedThreatProtectionSettingsListByServerOptionalParams) => PagedAsyncIterableIterator; } // @public -export type AdvancedThreatProtectionSettingsListByServerResponse = AdvancedThreatProtectionSettingsList; - -// @public -export interface AdvancedThreatProtectionSettingsModel extends ProxyResource { +export interface AdvancedThreatProtectionSettingsProperties { readonly creationTime?: Date; - state?: ThreatProtectionState; + state: ThreatProtectionState; } // @public @@ -161,9 +130,19 @@ export interface AuthConfigForPatch { tenantId?: 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 AzureManagedDiskPerformanceTier = string; +// @public +export type AzureSupportedClouds = `${AzureClouds}`; + // @public export interface Backup { backupRetentionDays?: number; @@ -179,16 +158,17 @@ export interface BackupAutomaticAndOnDemand extends ProxyResource { } // @public -export interface BackupAutomaticAndOnDemandList { - nextLink?: string; - value?: BackupAutomaticAndOnDemand[]; +export interface BackupAutomaticAndOnDemandProperties { + backupType?: BackupType; + completedTime?: Date; + source?: string; } // @public export interface BackupForPatch { backupRetentionDays?: number; readonly earliestRestoreDate?: Date; - geoRedundantBackup?: GeographicallyRedundantBackup; + readonly geoRedundantBackup?: GeographicallyRedundantBackup; } // @public @@ -197,123 +177,56 @@ export interface BackupRequestBase { } // @public -export interface BackupsAutomaticAndOnDemand { - beginCreate(resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandCreateOptionalParams): Promise, BackupsAutomaticAndOnDemandCreateResponse>>; - beginCreateAndWait(resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandCreateOptionalParams): Promise; - beginDelete(resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandDeleteOptionalParams): Promise, BackupsAutomaticAndOnDemandDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandDeleteOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: BackupsAutomaticAndOnDemandListByServerOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface BackupsAutomaticAndOnDemandCreateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface BackupsAutomaticAndOnDemandCreateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface BackupsAutomaticAndOnDemandCreateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type BackupsAutomaticAndOnDemandCreateResponse = BackupAutomaticAndOnDemand; - -// @public -export interface BackupsAutomaticAndOnDemandDeleteHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface BackupsAutomaticAndOnDemandDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface BackupsAutomaticAndOnDemandDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type BackupsAutomaticAndOnDemandDeleteResponse = BackupsAutomaticAndOnDemandDeleteHeaders; - -// @public -export interface BackupsAutomaticAndOnDemandGetOptionalParams extends coreClient.OperationOptions { +export interface BackupsAutomaticAndOnDemandGetOptionalParams extends OperationOptions { } // @public -export type BackupsAutomaticAndOnDemandGetResponse = BackupAutomaticAndOnDemand; - -// @public -export interface BackupsAutomaticAndOnDemandListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface BackupsAutomaticAndOnDemandListByServerOptionalParams extends OperationOptions { } // @public -export type BackupsAutomaticAndOnDemandListByServerNextResponse = BackupAutomaticAndOnDemandList; - -// @public -export interface BackupsAutomaticAndOnDemandListByServerOptionalParams extends coreClient.OperationOptions { +export interface BackupsAutomaticAndOnDemandOperations { + // @deprecated (undocumented) + beginCreate: (resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandCreateOptionalParams) => Promise, BackupAutomaticAndOnDemand>>; + // @deprecated (undocumented) + beginCreateAndWait: (resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandCreateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandDeleteOptionalParams) => Promise; + create: (resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandCreateOptionalParams) => PollerLike, BackupAutomaticAndOnDemand>; + delete: (resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, serverName: string, backupName: string, options?: BackupsAutomaticAndOnDemandGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: BackupsAutomaticAndOnDemandListByServerOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type BackupsAutomaticAndOnDemandListByServerResponse = BackupAutomaticAndOnDemandList; - // @public export interface BackupSettings { backupName: string; } // @public -export interface BackupsLongTermRetention { - beginStart(resourceGroupName: string, serverName: string, parameters: BackupsLongTermRetentionRequest, options?: BackupsLongTermRetentionStartOptionalParams): Promise, BackupsLongTermRetentionStartResponse>>; - beginStartAndWait(resourceGroupName: string, serverName: string, parameters: BackupsLongTermRetentionRequest, options?: BackupsLongTermRetentionStartOptionalParams): Promise; - checkPrerequisites(resourceGroupName: string, serverName: string, parameters: LtrPreBackupRequest, options?: BackupsLongTermRetentionCheckPrerequisitesOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, backupName: string, options?: BackupsLongTermRetentionGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: BackupsLongTermRetentionListByServerOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface BackupsLongTermRetentionCheckPrerequisitesExceptionHeaders { - xMsErrorCode?: string; - xMsRequestId?: string; -} - -// @public -export interface BackupsLongTermRetentionCheckPrerequisitesHeaders { - xMsRequestId?: string; -} - -// @public -export interface BackupsLongTermRetentionCheckPrerequisitesOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type BackupsLongTermRetentionCheckPrerequisitesResponse = BackupsLongTermRetentionCheckPrerequisitesHeaders & LtrPreBackupResponse; - -// @public -export interface BackupsLongTermRetentionGetOptionalParams extends coreClient.OperationOptions { +export interface BackupsLongTermRetentionCheckPrerequisitesOptionalParams extends OperationOptions { } // @public -export type BackupsLongTermRetentionGetResponse = BackupsLongTermRetentionOperation; - -// @public -export interface BackupsLongTermRetentionListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface BackupsLongTermRetentionGetOptionalParams extends OperationOptions { } // @public -export type BackupsLongTermRetentionListByServerNextResponse = LtrServerBackupOperationList; - -// @public -export interface BackupsLongTermRetentionListByServerOptionalParams extends coreClient.OperationOptions { +export interface BackupsLongTermRetentionListByServerOptionalParams extends OperationOptions { } -// @public -export type BackupsLongTermRetentionListByServerResponse = LtrServerBackupOperationList; - // @public export interface BackupsLongTermRetentionOperation extends ProxyResource { backupMetadata?: string; @@ -328,6 +241,18 @@ export interface BackupsLongTermRetentionOperation extends ProxyResource { status?: ExecutionStatus; } +// @public +export interface BackupsLongTermRetentionOperations { + // @deprecated (undocumented) + beginStart: (resourceGroupName: string, serverName: string, parameters: BackupsLongTermRetentionRequest, options?: BackupsLongTermRetentionStartOptionalParams) => Promise, BackupsLongTermRetentionResponse>>; + // @deprecated (undocumented) + beginStartAndWait: (resourceGroupName: string, serverName: string, parameters: BackupsLongTermRetentionRequest, options?: BackupsLongTermRetentionStartOptionalParams) => Promise; + checkPrerequisites: (resourceGroupName: string, serverName: string, parameters: LtrPreBackupRequest, options?: BackupsLongTermRetentionCheckPrerequisitesOptionalParams) => Promise; + get: (resourceGroupName: string, serverName: string, backupName: string, options?: BackupsLongTermRetentionGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: BackupsLongTermRetentionListByServerOptionalParams) => PagedAsyncIterableIterator; + start: (resourceGroupName: string, serverName: string, parameters: BackupsLongTermRetentionRequest, options?: BackupsLongTermRetentionStartOptionalParams) => PollerLike, BackupsLongTermRetentionResponse>; +} + // @public export interface BackupsLongTermRetentionRequest extends BackupRequestBase { targetDetails: BackupStoreDetails; @@ -348,25 +273,15 @@ export interface BackupsLongTermRetentionResponse { } // @public -export interface BackupsLongTermRetentionStartExceptionHeaders { - xMsErrorCode?: string; - xMsRequestId?: string; -} - -// @public -export interface BackupsLongTermRetentionStartHeaders { - xMsRequestId?: string; +export interface BackupsLongTermRetentionResponseProperties { + numberOfContainers: number; } // @public -export interface BackupsLongTermRetentionStartOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface BackupsLongTermRetentionStartOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type BackupsLongTermRetentionStartResponse = BackupsLongTermRetentionStartHeaders & BackupsLongTermRetentionResponse; - // @public export interface BackupStoreDetails { sasUriList: string[]; @@ -379,43 +294,23 @@ export type BackupType = string; export type Cancel = string; // @public -export interface CapabilitiesByLocation { - list(locationName: string, options?: CapabilitiesByLocationListOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface CapabilitiesByLocationListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CapabilitiesByLocationListNextResponse = CapabilityList; - -// @public -export interface CapabilitiesByLocationListOptionalParams extends coreClient.OperationOptions { +export interface CapabilitiesByLocationListOptionalParams extends OperationOptions { } // @public -export type CapabilitiesByLocationListResponse = CapabilityList; - -// @public -export interface CapabilitiesByServer { - list(resourceGroupName: string, serverName: string, options?: CapabilitiesByServerListOptionalParams): PagedAsyncIterableIterator; +export interface CapabilitiesByLocationOperations { + list: (locationName: string, options?: CapabilitiesByLocationListOptionalParams) => PagedAsyncIterableIterator; } // @public -export interface CapabilitiesByServerListNextOptionalParams extends coreClient.OperationOptions { +export interface CapabilitiesByServerListOptionalParams extends OperationOptions { } // @public -export type CapabilitiesByServerListNextResponse = CapabilityList; - -// @public -export interface CapabilitiesByServerListOptionalParams extends coreClient.OperationOptions { +export interface CapabilitiesByServerOperations { + list: (resourceGroupName: string, serverName: string, options?: CapabilitiesByServerListOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type CapabilitiesByServerListResponse = CapabilityList; - // @public export interface Capability extends CapabilityBase { readonly fastProvisioningSupported?: FastProvisioningSupport; @@ -438,12 +333,6 @@ export interface CapabilityBase { readonly status?: CapabilityStatus; } -// @public -export interface CapabilityList { - nextLink?: string; - readonly value?: Capability[]; -} - // @public export type CapabilityStatus = "Visible" | "Available" | "Default" | "Disabled"; @@ -457,30 +346,23 @@ export interface CapturedLog extends ProxyResource { } // @public -export interface CapturedLogList { - nextLink?: string; - value?: CapturedLog[]; -} - -// @public -export interface CapturedLogs { - listByServer(resourceGroupName: string, serverName: string, options?: CapturedLogsListByServerOptionalParams): PagedAsyncIterableIterator; +export interface CapturedLogProperties { + createdTime?: Date; + lastModifiedTime?: Date; + sizeInKb?: number; + type?: string; + url?: string; } // @public -export interface CapturedLogsListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface CapturedLogsListByServerOptionalParams extends OperationOptions { } // @public -export type CapturedLogsListByServerNextResponse = CapturedLogList; - -// @public -export interface CapturedLogsListByServerOptionalParams extends coreClient.OperationOptions { +export interface CapturedLogsOperations { + listByServer: (resourceGroupName: string, serverName: string, options?: CapturedLogsListByServerOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type CapturedLogsListByServerResponse = CapturedLogList; - // @public export type CheckNameAvailabilityReason = string; @@ -537,75 +419,58 @@ export interface ConfigurationForUpdate { } // @public -export interface ConfigurationList { - nextLink?: string; - value?: Configuration[]; -} - -// @public -export interface Configurations { - beginPut(resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsPutOptionalParams): Promise, ConfigurationsPutResponse>>; - beginPutAndWait(resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsPutOptionalParams): Promise; - beginUpdate(resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsUpdateOptionalParams): Promise, ConfigurationsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsUpdateOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, configurationName: string, options?: ConfigurationsGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: ConfigurationsListByServerOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface ConfigurationsGetOptionalParams extends coreClient.OperationOptions { +export interface ConfigurationProperties { + readonly allowedValues?: string; + readonly dataType?: ConfigurationDataType; + readonly defaultValue?: string; + readonly description?: string; + readonly documentationLink?: string; + readonly isConfigPendingRestart?: boolean; + readonly isDynamicConfig?: boolean; + readonly isReadOnly?: boolean; + source?: string; + readonly unit?: string; + value?: string; } // @public -export type ConfigurationsGetResponse = Configuration; - -// @public -export interface ConfigurationsListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface ConfigurationsGetOptionalParams extends OperationOptions { } // @public -export type ConfigurationsListByServerNextResponse = ConfigurationList; - -// @public -export interface ConfigurationsListByServerOptionalParams extends coreClient.OperationOptions { +export interface ConfigurationsListByServerOptionalParams extends OperationOptions { } // @public -export type ConfigurationsListByServerResponse = ConfigurationList; - -// @public -export interface ConfigurationsPutHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface ConfigurationsOperations { + // @deprecated (undocumented) + beginPut: (resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsPutOptionalParams) => Promise, Configuration>>; + // @deprecated (undocumented) + beginPutAndWait: (resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsPutOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsUpdateOptionalParams) => Promise, Configuration>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsUpdateOptionalParams) => Promise; + get: (resourceGroupName: string, serverName: string, configurationName: string, options?: ConfigurationsGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: ConfigurationsListByServerOptionalParams) => PagedAsyncIterableIterator; + put: (resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsPutOptionalParams) => PollerLike, Configuration>; + update: (resourceGroupName: string, serverName: string, configurationName: string, parameters: ConfigurationForUpdate, options?: ConfigurationsUpdateOptionalParams) => PollerLike, Configuration>; } // @public -export interface ConfigurationsPutOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ConfigurationsPutOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type ConfigurationsPutResponse = Configuration; - -// @public -export interface ConfigurationsUpdateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface ConfigurationsUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ConfigurationsUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type ConfigurationsUpdateResponse = Configuration; +export type ContinuablePage = TPage & { + continuationToken?: string; +}; // @public export type CreatedByType = string; @@ -622,12 +487,6 @@ export interface Database extends ProxyResource { collation?: string; } -// @public -export interface DatabaseList { - nextLink?: string; - value?: Database[]; -} - // @public export interface DatabaseMigrationState { appliedChanges?: number; @@ -649,76 +508,51 @@ export interface DatabaseMigrationState { } // @public -export interface Databases { - beginCreate(resourceGroupName: string, serverName: string, databaseName: string, parameters: Database, options?: DatabasesCreateOptionalParams): Promise, DatabasesCreateResponse>>; - beginCreateAndWait(resourceGroupName: string, serverName: string, databaseName: string, parameters: Database, options?: DatabasesCreateOptionalParams): Promise; - beginDelete(resourceGroupName: string, serverName: string, databaseName: string, options?: DatabasesDeleteOptionalParams): Promise, DatabasesDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, serverName: string, databaseName: string, options?: DatabasesDeleteOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, options?: DatabasesGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: DatabasesListByServerOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface DatabasesCreateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface DatabaseProperties { + charset?: string; + collation?: string; } // @public -export interface DatabasesCreateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DatabasesCreateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type DatabasesCreateResponse = Database; - -// @public -export interface DatabasesDeleteHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface DatabasesDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DatabasesDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type DatabasesDeleteResponse = DatabasesDeleteHeaders; - -// @public -export interface DatabasesGetOptionalParams extends coreClient.OperationOptions { +export interface DatabasesGetOptionalParams extends OperationOptions { } // @public -export type DatabasesGetResponse = Database; - -// @public -export interface DatabasesListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface DatabasesListByServerOptionalParams extends OperationOptions { } // @public -export type DatabasesListByServerNextResponse = DatabaseList; - -// @public -export interface DatabasesListByServerOptionalParams extends coreClient.OperationOptions { +export interface DatabasesOperations { + // @deprecated (undocumented) + beginCreate: (resourceGroupName: string, serverName: string, databaseName: string, parameters: Database, options?: DatabasesCreateOptionalParams) => Promise, Database>>; + // @deprecated (undocumented) + beginCreateAndWait: (resourceGroupName: string, serverName: string, databaseName: string, parameters: Database, options?: DatabasesCreateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, serverName: string, databaseName: string, options?: DatabasesDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, serverName: string, databaseName: string, options?: DatabasesDeleteOptionalParams) => Promise; + create: (resourceGroupName: string, serverName: string, databaseName: string, parameters: Database, options?: DatabasesCreateOptionalParams) => PollerLike, Database>; + delete: (resourceGroupName: string, serverName: string, databaseName: string, options?: DatabasesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, serverName: string, databaseName: string, options?: DatabasesGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: DatabasesListByServerOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type DatabasesListByServerResponse = DatabaseList; - // @public export interface DataEncryption { - geoBackupEncryptionKeyStatus?: EncryptionKeyStatus; + readonly geoBackupEncryptionKeyStatus?: EncryptionKeyStatus; geoBackupKeyURI?: string; geoBackupUserAssignedIdentityId?: string; - primaryEncryptionKeyStatus?: EncryptionKeyStatus; + readonly primaryEncryptionKeyStatus?: EncryptionKeyStatus; primaryKeyURI?: string; primaryUserAssignedIdentityId?: string; type?: DataEncryptionType; @@ -754,7 +588,7 @@ export type EncryptionKeyStatus = string; // @public export interface ErrorAdditionalInfo { - readonly info?: Record; + readonly info?: any; readonly type?: string; } @@ -800,95 +634,61 @@ export interface FirewallRule extends ProxyResource { } // @public -export interface FirewallRuleList { - nextLink?: string; - value?: FirewallRule[]; -} - -// @public -export interface FirewallRules { - beginCreateOrUpdate(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams): Promise, FirewallRulesCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): Promise, FirewallRulesDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: FirewallRulesListByServerOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface FirewallRulesCreateOrUpdateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface FirewallRuleProperties { + endIpAddress: string; + startIpAddress: string; } // @public -export interface FirewallRulesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type FirewallRulesCreateOrUpdateResponse = FirewallRule; - -// @public -export interface FirewallRulesDeleteHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface FirewallRulesDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface FirewallRulesDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type FirewallRulesDeleteResponse = FirewallRulesDeleteHeaders; - -// @public -export interface FirewallRulesGetOptionalParams extends coreClient.OperationOptions { +export interface FirewallRulesGetOptionalParams extends OperationOptions { } // @public -export type FirewallRulesGetResponse = FirewallRule; - -// @public -export interface FirewallRulesListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface FirewallRulesListByServerOptionalParams extends OperationOptions { } // @public -export type FirewallRulesListByServerNextResponse = FirewallRuleList; - -// @public -export interface FirewallRulesListByServerOptionalParams extends coreClient.OperationOptions { +export interface FirewallRulesOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => Promise, FirewallRule>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, serverName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, serverName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, FirewallRule>; + delete: (resourceGroupName: string, serverName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, serverName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: FirewallRulesListByServerOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type FirewallRulesListByServerResponse = FirewallRuleList; - // @public export type GeographicallyRedundantBackup = string; // @public export type GeographicallyRedundantBackupSupport = string; -// @public -export function getContinuationToken(page: unknown): string | undefined; - // @public export interface HighAvailability { - mode?: HighAvailabilityMode; + mode?: PostgreSqlFlexibleServerHighAvailabilityMode; standbyAvailabilityZone?: string; readonly state?: HighAvailabilityState; } // @public export interface HighAvailabilityForPatch { - mode?: HighAvailabilityMode; + mode?: PostgreSqlFlexibleServerHighAvailabilityMode; standbyAvailabilityZone?: string; readonly state?: HighAvailabilityState; } @@ -1091,13 +891,6 @@ export enum KnownMigrationDatabaseState { WaitingForCutoverTrigger = "WaitingForCutoverTrigger" } -// @public -export enum KnownMigrationDetailsLevel { - Default = "Default", - Full = "Full", - Summary = "Summary" -} - // @public export enum KnownMigrationListFilter { Active = "Active", @@ -1150,6 +943,16 @@ export enum KnownMigrationSubstate { WaitingForTargetDBOverwriteConfirmation = "WaitingForTargetDBOverwriteConfirmation" } +// @public +export enum KnownNetworkMigrationState { + CancelInProgress = "CancelInProgress", + Cancelled = "Cancelled", + Failed = "Failed", + InProgress = "InProgress", + Pending = "Pending", + Succeeded = "Succeeded" +} + // @public export enum KnownOnlineStorageResizeSupport { Disabled = "Disabled", @@ -1187,6 +990,13 @@ export enum KnownPostgresMajorVersion { Twelve = "12" } +// @public +export enum KnownPostgreSqlFlexibleServerHighAvailabilityMode { + Disabled = "Disabled", + SameZone = "SameZone", + ZoneRedundant = "ZoneRedundant" +} + // @public export enum KnownPrincipalType { Group = "Group", @@ -1227,7 +1037,8 @@ export enum KnownRecommendationTypeEnum { AnalyzeTable = "AnalyzeTable", CreateIndex = "CreateIndex", DropIndex = "DropIndex", - ReIndex = "ReIndex" + ReIndex = "ReIndex", + VacuumTable = "VacuumTable" } // @public @@ -1235,7 +1046,8 @@ export enum KnownRecommendationTypeParameterEnum { AnalyzeTable = "AnalyzeTable", CreateIndex = "CreateIndex", DropIndex = "DropIndex", - ReIndex = "ReIndex" + ReIndex = "ReIndex", + VacuumTable = "VacuumTable" } // @public @@ -1368,6 +1180,12 @@ export enum KnownValidationState { Warning = "Warning" } +// @public +export enum KnownVersions { + V20250801 = "2025-08-01", + V20260101 = "2026-01-01-preview" +} + // @public export enum KnownVirtualEndpointType { ReadWrite = "ReadWrite" @@ -1392,18 +1210,33 @@ export type LocationRestricted = string; export type LogicalReplicationOnSourceServer = string; // @public -export interface LtrPreBackupRequest extends BackupRequestBase { +export interface LogSpecification { + blobDuration?: string; + displayName?: string; + name?: string; } // @public -export interface LtrPreBackupResponse { - numberOfContainers: number; +export interface LtrBackupOperationResponseProperties { + backupMetadata?: string; + backupName?: string; + datasourceSizeInBytes?: number; + dataTransferredInBytes?: number; + endTime?: Date; + readonly errorCode?: string; + readonly errorMessage?: string; + percentComplete?: number; + startTime: Date; + status: ExecutionStatus; +} + +// @public +export interface LtrPreBackupRequest extends BackupRequestBase { } // @public -export interface LtrServerBackupOperationList { - nextLink?: string; - value?: BackupsLongTermRetentionOperation[]; +export interface LtrPreBackupResponse { + numberOfContainers: number; } // @public @@ -1423,7 +1256,27 @@ export interface MaintenanceWindowForPatch { } // @public -export type MicrosoftEntraAuth = string; +export interface MetricSpecification { + aggregationType?: string; + category?: string; + displayDescription?: string; + displayName?: string; + name?: string; + supportedAggregationTypes?: string[]; + supportedTimeGrainTypes?: string[]; + unit?: string; +} + +// @public +export type MicrosoftEntraAuth = string; + +// @public +export interface MigrateNetworkStatus { + resourceGroupName?: string; + serverName?: string; + readonly state?: NetworkMigrationState; + subscriptionId?: string; +} // @public export type MigrateRolesAndPermissions = string; @@ -1460,15 +1313,6 @@ export interface Migration extends TrackedResource { // @public export type MigrationDatabaseState = string; -// @public -export type MigrationDetailsLevel = string; - -// @public -export interface MigrationList { - nextLink?: string; - readonly value?: Migration[]; -} - // @public export type MigrationListFilter = string; @@ -1491,57 +1335,84 @@ export type MigrationNameAvailabilityReason = string; export type MigrationOption = string; // @public -export interface MigrationResourceForPatch { +export interface MigrationProperties { cancel?: Cancel; + readonly currentStatus?: MigrationStatus; dbsToCancelMigrationOn?: string[]; dbsToMigrate?: string[]; dbsToTriggerCutoverOn?: string[]; migrateRoles?: MigrateRolesAndPermissions; + readonly migrationId?: string; + migrationInstanceResourceId?: string; migrationMode?: MigrationMode; + migrationOption?: MigrationOption; + migrationWindowEndTimeInUtc?: Date; migrationWindowStartTimeInUtc?: Date; overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; - secretParameters?: MigrationSecretParametersForPatch; + secretParameters?: MigrationSecretParameters; setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; sourceDbServerFullyQualifiedDomainName?: string; + readonly sourceDbServerMetadata?: DbServerMetadata; sourceDbServerResourceId?: string; + sourceType?: SourceType; + sslMode?: SslMode; startDataMigration?: StartDataMigration; - tags?: { - [propertyName: string]: string; - }; targetDbServerFullyQualifiedDomainName?: string; + readonly targetDbServerMetadata?: DbServerMetadata; + readonly targetDbServerResourceId?: string; triggerCutover?: TriggerCutover; } // @public -export interface Migrations { - cancel(resourceGroupName: string, serverName: string, migrationName: string, options?: MigrationsCancelOptionalParams): Promise; - checkNameAvailability(resourceGroupName: string, serverName: string, parameters: MigrationNameAvailability, options?: MigrationsCheckNameAvailabilityOptionalParams): Promise; - create(resourceGroupName: string, serverName: string, migrationName: string, parameters: Migration, options?: MigrationsCreateOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, migrationName: string, options?: MigrationsGetOptionalParams): Promise; - listByTargetServer(resourceGroupName: string, serverName: string, options?: MigrationsListByTargetServerOptionalParams): PagedAsyncIterableIterator; - update(resourceGroupName: string, serverName: string, migrationName: string, parameters: MigrationResourceForPatch, options?: MigrationsUpdateOptionalParams): Promise; +export interface MigrationPropertiesForPatch { + cancel?: Cancel; + dbsToCancelMigrationOn?: string[]; + dbsToMigrate?: string[]; + dbsToTriggerCutoverOn?: string[]; + migrateRoles?: MigrateRolesAndPermissions; + migrationMode?: MigrationMode; + migrationWindowStartTimeInUtc?: Date; + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + secretParameters?: MigrationSecretParametersForPatch; + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + sourceDbServerFullyQualifiedDomainName?: string; + sourceDbServerResourceId?: string; + startDataMigration?: StartDataMigration; + targetDbServerFullyQualifiedDomainName?: string; + triggerCutover?: TriggerCutover; } // @public -export interface MigrationsCancelOptionalParams extends coreClient.OperationOptions { +export interface MigrationResourceForPatch { + cancel?: Cancel; + dbsToCancelMigrationOn?: string[]; + dbsToMigrate?: string[]; + dbsToTriggerCutoverOn?: string[]; + migrateRoles?: MigrateRolesAndPermissions; + migrationMode?: MigrationMode; + migrationWindowStartTimeInUtc?: Date; + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + secretParameters?: MigrationSecretParametersForPatch; + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + sourceDbServerFullyQualifiedDomainName?: string; + sourceDbServerResourceId?: string; + startDataMigration?: StartDataMigration; + tags?: Record; + targetDbServerFullyQualifiedDomainName?: string; + triggerCutover?: TriggerCutover; } // @public -export type MigrationsCancelResponse = Migration; - -// @public -export interface MigrationsCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +export interface MigrationsCancelOptionalParams extends OperationOptions { } // @public -export type MigrationsCheckNameAvailabilityResponse = MigrationNameAvailability; - -// @public -export interface MigrationsCreateOptionalParams extends coreClient.OperationOptions { +export interface MigrationsCheckNameAvailabilityOptionalParams extends OperationOptions { } // @public -export type MigrationsCreateResponse = Migration; +export interface MigrationsCreateOptionalParams extends OperationOptions { +} // @public export interface MigrationSecretParameters { @@ -1558,26 +1429,23 @@ export interface MigrationSecretParametersForPatch { } // @public -export interface MigrationsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MigrationsGetResponse = Migration; - -// @public -export interface MigrationsListByTargetServerNextOptionalParams extends coreClient.OperationOptions { +export interface MigrationsGetOptionalParams extends OperationOptions { } // @public -export type MigrationsListByTargetServerNextResponse = MigrationList; - -// @public -export interface MigrationsListByTargetServerOptionalParams extends coreClient.OperationOptions { +export interface MigrationsListByTargetServerOptionalParams extends OperationOptions { migrationListFilter?: MigrationListFilter; } // @public -export type MigrationsListByTargetServerResponse = MigrationList; +export interface MigrationsOperations { + cancel: (resourceGroupName: string, serverName: string, migrationName: string, options?: MigrationsCancelOptionalParams) => Promise; + checkNameAvailability: (resourceGroupName: string, serverName: string, parameters: MigrationNameAvailability, options?: MigrationsCheckNameAvailabilityOptionalParams) => Promise; + create: (resourceGroupName: string, serverName: string, migrationName: string, parameters: Migration, options?: MigrationsCreateOptionalParams) => Promise; + get: (resourceGroupName: string, serverName: string, migrationName: string, options?: MigrationsGetOptionalParams) => Promise; + listByTargetServer: (resourceGroupName: string, serverName: string, options?: MigrationsListByTargetServerOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, serverName: string, migrationName: string, parameters: MigrationResourceForPatch, options?: MigrationsUpdateOptionalParams) => Promise; +} // @public export type MigrationState = string; @@ -1595,45 +1463,36 @@ export type MigrationSubstate = string; // @public export interface MigrationSubstateDetails { readonly currentSubState?: MigrationSubstate; - dbDetails?: { - [propertyName: string]: DatabaseMigrationState; - }; + // (undocumented) + dbDetails?: Record; + // (undocumented) validationDetails?: ValidationDetails; } // @public -export interface MigrationsUpdateOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MigrationsUpdateResponse = Migration; - -// @public -export interface NameAvailability { - checkGlobally(parameters: CheckNameAvailabilityRequest, options?: NameAvailabilityCheckGloballyOptionalParams): Promise; - checkWithLocation(locationName: string, parameters: CheckNameAvailabilityRequest, options?: NameAvailabilityCheckWithLocationOptionalParams): Promise; +export interface MigrationsUpdateOptionalParams extends OperationOptions { } // @public -export interface NameAvailabilityCheckGloballyOptionalParams extends coreClient.OperationOptions { +export interface NameAvailabilityCheckGloballyOptionalParams extends OperationOptions { } // @public -export type NameAvailabilityCheckGloballyResponse = NameAvailabilityModel; - -// @public -export interface NameAvailabilityCheckWithLocationOptionalParams extends coreClient.OperationOptions { +export interface NameAvailabilityCheckWithLocationOptionalParams extends OperationOptions { } -// @public -export type NameAvailabilityCheckWithLocationResponse = NameAvailabilityModel; - // @public export interface NameAvailabilityModel extends CheckNameAvailabilityResponse { readonly name?: string; readonly type?: string; } +// @public +export interface NameAvailabilityOperations { + checkGlobally: (parameters: CheckNameAvailabilityRequest, options?: NameAvailabilityCheckGloballyOptionalParams) => Promise; + checkWithLocation: (locationName: string, parameters: CheckNameAvailabilityRequest, options?: NameAvailabilityCheckWithLocationOptionalParams) => Promise; +} + // @public export interface NameProperty { localizedValue?: string; @@ -1647,6 +1506,9 @@ export interface Network { publicNetworkAccess?: ServerPublicNetworkAccessState; } +// @public +export type NetworkMigrationState = string; + // @public export interface ObjectRecommendation extends ProxyResource { analyzedWorkload?: ObjectRecommendationPropertiesAnalyzedWorkload; @@ -1675,9 +1537,18 @@ export interface ObjectRecommendationDetails { } // @public -export interface ObjectRecommendationList { - nextLink?: string; - value?: ObjectRecommendation[]; +export interface ObjectRecommendationProperties { + analyzedWorkload?: ObjectRecommendationPropertiesAnalyzedWorkload; + currentState?: string; + readonly details?: ObjectRecommendationDetails; + readonly estimatedImpact?: ImpactRecord[]; + implementationDetails?: ObjectRecommendationPropertiesImplementationDetails; + improvedQueryIds?: number[]; + initialRecommendedTime?: Date; + lastRecommendedTime?: Date; + recommendationReason?: string; + recommendationType?: RecommendationTypeEnum; + timesRecommended?: number; } // @public @@ -1702,9 +1573,7 @@ export interface Operation { isDataAction?: boolean; readonly name?: string; readonly origin?: OperationOrigin; - readonly properties?: { - [propertyName: string]: Record; - }; + readonly properties?: OperationProperties; } // @public @@ -1715,36 +1584,37 @@ export interface OperationDisplay { readonly resource?: string; } -// @public -export interface OperationList { - nextLink?: string; - value?: Operation[]; -} - // @public export type OperationOrigin = string; // @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +export interface OperationProperties { + serviceSpecification?: ServiceSpecification; } // @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +export interface OperationsListOptionalParams extends OperationOptions { } // @public -export type OperationsListNextResponse = OperationList; +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} // @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { -} +export type OverwriteDatabasesOnTargetServer = string; // @public -export type OperationsListResponse = OperationList; +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} // @public -export type OverwriteDatabasesOnTargetServer = string; +export interface PageSettings { + continuationToken?: string; +} // @public export type PasswordBasedAuth = string; @@ -1752,88 +1622,62 @@ export type PasswordBasedAuth = string; // @public export type PostgresMajorVersion = string; -// @public (undocumented) -export class PostgreSQLManagementFlexibleServerClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: PostgreSQLManagementFlexibleServerClientOptionalParams); - constructor(credentials: coreAuth.TokenCredential, options?: PostgreSQLManagementFlexibleServerClientOptionalParams); - // (undocumented) - administratorsMicrosoftEntra: AdministratorsMicrosoftEntra; - // (undocumented) - advancedThreatProtectionSettings: AdvancedThreatProtectionSettings; - // (undocumented) - apiVersion: string; - // (undocumented) - backupsAutomaticAndOnDemand: BackupsAutomaticAndOnDemand; - // (undocumented) - backupsLongTermRetention: BackupsLongTermRetention; - // (undocumented) - capabilitiesByLocation: CapabilitiesByLocation; - // (undocumented) - capabilitiesByServer: CapabilitiesByServer; - // (undocumented) - capturedLogs: CapturedLogs; - // (undocumented) - configurations: Configurations; - // (undocumented) - databases: Databases; - // (undocumented) - firewallRules: FirewallRules; - // (undocumented) - migrations: Migrations; - // (undocumented) - nameAvailability: NameAvailability; - // (undocumented) - operations: Operations; - // (undocumented) - privateDnsZoneSuffix: PrivateDnsZoneSuffix; - // (undocumented) - privateEndpointConnections: PrivateEndpointConnections; - // (undocumented) - privateLinkResources: PrivateLinkResources; - // (undocumented) - quotaUsages: QuotaUsages; - // (undocumented) - replicas: Replicas; - // (undocumented) - servers: Servers; - // (undocumented) - serverThreatProtectionSettings: ServerThreatProtectionSettings; - // (undocumented) - subscriptionId?: string; - // (undocumented) - tuningOptionsOperations: TuningOptionsOperations; - // (undocumented) - virtualEndpoints: VirtualEndpoints; - // (undocumented) - virtualNetworkSubnetUsage: VirtualNetworkSubnetUsage; -} - // @public -export interface PostgreSQLManagementFlexibleServerClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; +export type PostgreSqlFlexibleServerHighAvailabilityMode = string; + +// @public (undocumented) +export class PostgreSQLManagementFlexibleServerClient { + constructor(credential: TokenCredential, options?: PostgreSQLManagementFlexibleServerClientOptionalParams); + constructor(credential: TokenCredential, subscriptionId: string, options?: PostgreSQLManagementFlexibleServerClientOptionalParams); + readonly administratorsMicrosoftEntra: AdministratorsMicrosoftEntraOperations; + readonly advancedThreatProtectionSettings: AdvancedThreatProtectionSettingsOperations; + readonly backupsAutomaticAndOnDemand: BackupsAutomaticAndOnDemandOperations; + readonly backupsLongTermRetention: BackupsLongTermRetentionOperations; + readonly capabilitiesByLocation: CapabilitiesByLocationOperations; + readonly capabilitiesByServer: CapabilitiesByServerOperations; + readonly capturedLogs: CapturedLogsOperations; + readonly configurations: ConfigurationsOperations; + readonly databases: DatabasesOperations; + readonly firewallRules: FirewallRulesOperations; + readonly migrations: MigrationsOperations; + readonly nameAvailability: NameAvailabilityOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly privateDnsZoneSuffix: PrivateDnsZoneSuffixOperations; + readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + readonly privateLinkResources: PrivateLinkResourcesOperations; + readonly quotaUsages: QuotaUsagesOperations; + readonly replicas: ReplicasOperations; + readonly servers: ServersOperations; + readonly serverThreatProtectionSettings: ServerThreatProtectionSettingsOperations; + readonly tuningOptions: TuningOptionsOperations; + readonly virtualEndpoints: VirtualEndpointsOperations; + readonly virtualNetworkSubnetUsage: VirtualNetworkSubnetUsageOperations; +} + +// @public +export interface PostgreSQLManagementFlexibleServerClientOptionalParams extends ClientOptions { apiVersion?: string; - endpoint?: string; + cloudSetting?: AzureSupportedClouds; } // @public export type PrincipalType = string; // @public -export interface PrivateDnsZoneSuffix { - get(options?: PrivateDnsZoneSuffixGetOptionalParams): Promise; -} - -// @public -export interface PrivateDnsZoneSuffixGetOptionalParams extends coreClient.OperationOptions { +export interface PrivateDnsZoneSuffixGetOptionalParams extends OperationOptions { } -// @public +// @public (undocumented) export type PrivateDnsZoneSuffixGetResponse = { body: string; }; +// @public +export interface PrivateDnsZoneSuffixOperations { + get: (options?: PrivateDnsZoneSuffixGetOptionalParams) => Promise; +} + // @public export interface PrivateEndpoint { readonly id?: string; @@ -1848,122 +1692,81 @@ export interface PrivateEndpointConnection extends Resource { } // @public -export interface PrivateEndpointConnectionList { - nextLink?: string; - readonly value?: PrivateEndpointConnection[]; +export interface PrivateEndpointConnectionProperties { + readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; } // @public export type PrivateEndpointConnectionProvisioningState = string; // @public -export interface PrivateEndpointConnections { - beginDelete(resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, PrivateEndpointConnectionsDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, parameters: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams): Promise, PrivateEndpointConnectionsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, parameters: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: PrivateEndpointConnectionsListByServerOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface PrivateEndpointConnectionsDeleteHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface PrivateEndpointConnectionsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type PrivateEndpointConnectionsDeleteResponse = PrivateEndpointConnectionsDeleteHeaders; - -// @public -export interface PrivateEndpointConnectionsGetOptionalParams extends coreClient.OperationOptions { +export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { } // @public -export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; - -// @public -export interface PrivateEndpointConnectionsListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface PrivateEndpointConnectionsListByServerOptionalParams extends OperationOptions { } // @public -export type PrivateEndpointConnectionsListByServerNextResponse = PrivateEndpointConnectionList; - -// @public -export interface PrivateEndpointConnectionsListByServerOptionalParams extends coreClient.OperationOptions { +export interface PrivateEndpointConnectionsOperations { + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, parameters: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams) => Promise, PrivateEndpointConnection>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, parameters: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams) => Promise; + delete: (resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: PrivateEndpointConnectionsListByServerOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, serverName: string, privateEndpointConnectionName: string, parameters: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams) => PollerLike, PrivateEndpointConnection>; } // @public -export type PrivateEndpointConnectionsListByServerResponse = PrivateEndpointConnectionList; - -// @public -export interface PrivateEndpointConnectionsUpdateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface PrivateEndpointConnectionsUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface PrivateEndpointConnectionsUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type PrivateEndpointConnectionsUpdateResponse = PrivateEndpointConnection; - // @public export type PrivateEndpointServiceConnectionStatus = string; // @public -export interface PrivateLinkResource extends Resource { +export interface PrivateLinkResource extends ProxyResource { readonly groupId?: string; readonly requiredMembers?: string[]; requiredZoneNames?: string[]; } // @public -export interface PrivateLinkResourceList { - nextLink?: string; - readonly value?: PrivateLinkResource[]; -} - -// @public -export interface PrivateLinkResources { - get(resourceGroupName: string, serverName: string, groupName: string, options?: PrivateLinkResourcesGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: PrivateLinkResourcesListByServerOptionalParams): PagedAsyncIterableIterator; +export interface PrivateLinkResourceProperties { + readonly groupId?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; } // @public -export interface PrivateLinkResourcesGetOptionalParams extends coreClient.OperationOptions { +export interface PrivateLinkResourcesGetOptionalParams extends OperationOptions { } // @public -export type PrivateLinkResourcesGetResponse = PrivateLinkResource; - -// @public -export interface PrivateLinkResourcesListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface PrivateLinkResourcesListByServerOptionalParams extends OperationOptions { } // @public -export type PrivateLinkResourcesListByServerNextResponse = PrivateLinkResourceList; - -// @public -export interface PrivateLinkResourcesListByServerOptionalParams extends coreClient.OperationOptions { +export interface PrivateLinkResourcesOperations { + get: (resourceGroupName: string, serverName: string, groupName: string, options?: PrivateLinkResourcesGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: PrivateLinkResourcesListByServerOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type PrivateLinkResourcesListByServerResponse = PrivateLinkResourceList; - // @public export interface PrivateLinkServiceConnectionState { actionsRequired?: string; @@ -1985,30 +1788,14 @@ export interface QuotaUsage { } // @public -export interface QuotaUsageList { - nextLink?: string; - readonly value?: QuotaUsage[]; +export interface QuotaUsagesListOptionalParams extends OperationOptions { } // @public -export interface QuotaUsages { - list(locationName: string, options?: QuotaUsagesListOptionalParams): PagedAsyncIterableIterator; +export interface QuotaUsagesOperations { + list: (locationName: string, options?: QuotaUsagesListOptionalParams) => PagedAsyncIterableIterator; } -// @public -export interface QuotaUsagesListNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type QuotaUsagesListNextResponse = QuotaUsageList; - -// @public -export interface QuotaUsagesListOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type QuotaUsagesListResponse = QuotaUsageList; - // @public export type ReadReplicaPromoteMode = string; @@ -2031,17 +1818,14 @@ export interface Replica { } // @public -export interface Replicas { - listByServer(resourceGroupName: string, serverName: string, options?: ReplicasListByServerOptionalParams): PagedAsyncIterableIterator; +export interface ReplicasListByServerOptionalParams extends OperationOptions { } // @public -export interface ReplicasListByServerOptionalParams extends coreClient.OperationOptions { +export interface ReplicasOperations { + listByServer: (resourceGroupName: string, serverName: string, options?: ReplicasListByServerOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type ReplicasListByServerResponse = ServerList; - // @public export type ReplicationRole = string; @@ -2062,6 +1846,16 @@ export interface RestartParameter { restartWithFailover?: boolean; } +// @public +export function restorePoller(client: PostgreSQLManagementFlexibleServerClient, 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 Server extends TrackedResource { administratorLogin?: string; @@ -2100,7 +1894,7 @@ export interface ServerEditionCapability extends CapabilityBase { // @public export interface ServerForPatch { - administratorLogin?: string; + readonly administratorLogin?: string; administratorLoginPassword?: string; authConfig?: AuthConfigForPatch; availabilityZone?: string; @@ -2116,81 +1910,72 @@ export interface ServerForPatch { replicationRole?: ReplicationRole; sku?: SkuForPatch; storage?: Storage; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; version?: PostgresMajorVersion; } // @public -export interface ServerList { - nextLink?: string; - value?: Server[]; +export interface ServerProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + authConfig?: AuthConfig; + availabilityZone?: string; + backup?: Backup; + cluster?: Cluster; + createMode?: CreateMode; + dataEncryption?: DataEncryption; + readonly fullyQualifiedDomainName?: string; + highAvailability?: HighAvailability; + maintenanceWindow?: MaintenanceWindow; + readonly minorVersion?: string; + network?: Network; + pointInTimeUTC?: Date; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + replica?: Replica; + readonly replicaCapacity?: number; + replicationRole?: ReplicationRole; + sourceServerResourceId?: string; + readonly state?: ServerState; + storage?: Storage; + version?: PostgresMajorVersion; } // @public -export type ServerPublicNetworkAccessState = string; - -// @public -export interface Servers { - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: Server, options?: ServersCreateOrUpdateOptionalParams): Promise, ServersCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, serverName: string, parameters: Server, options?: ServersCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, serverName: string, options?: ServersDeleteOptionalParams): Promise, ServersDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, serverName: string, options?: ServersDeleteOptionalParams): Promise; - beginRestart(resourceGroupName: string, serverName: string, options?: ServersRestartOptionalParams): Promise, ServersRestartResponse>>; - beginRestartAndWait(resourceGroupName: string, serverName: string, options?: ServersRestartOptionalParams): Promise; - beginStart(resourceGroupName: string, serverName: string, options?: ServersStartOptionalParams): Promise, ServersStartResponse>>; - beginStartAndWait(resourceGroupName: string, serverName: string, options?: ServersStartOptionalParams): Promise; - beginStop(resourceGroupName: string, serverName: string, options?: ServersStopOptionalParams): Promise, ServersStopResponse>>; - beginStopAndWait(resourceGroupName: string, serverName: string, options?: ServersStopOptionalParams): Promise; - beginUpdate(resourceGroupName: string, serverName: string, parameters: ServerForPatch, options?: ServersUpdateOptionalParams): Promise, ServersUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, serverName: string, parameters: ServerForPatch, options?: ServersUpdateOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, options?: ServersGetOptionalParams): Promise; - listByResourceGroup(resourceGroupName: string, options?: ServersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listBySubscription(options?: ServersListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +export interface ServerPropertiesForPatch { + readonly administratorLogin?: string; + administratorLoginPassword?: string; + authConfig?: AuthConfigForPatch; + availabilityZone?: string; + backup?: BackupForPatch; + cluster?: Cluster; + createMode?: CreateModeForPatch; + dataEncryption?: DataEncryption; + highAvailability?: HighAvailabilityForPatch; + maintenanceWindow?: MaintenanceWindowForPatch; + network?: Network; + replica?: Replica; + replicationRole?: ReplicationRole; + storage?: Storage; + version?: PostgresMajorVersion; } // @public -export interface ServersCreateOrUpdateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} +export type ServerPublicNetworkAccessState = string; // @public -export interface ServersCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ServersCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type ServersCreateOrUpdateResponse = Server; - -// @public -export interface ServersDeleteHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface ServersDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ServersDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type ServersDeleteResponse = ServersDeleteHeaders; - -// @public -export interface ServersGetOptionalParams extends coreClient.OperationOptions { +export interface ServersGetOptionalParams extends OperationOptions { } -// @public -export type ServersGetResponse = Server; - // @public export interface ServerSku { name?: string; @@ -2210,133 +1995,131 @@ export interface ServerSkuCapability extends CapabilityBase { } // @public -export interface ServersListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +export interface ServersListByResourceGroupOptionalParams extends OperationOptions { } // @public -export type ServersListByResourceGroupNextResponse = ServerList; - -// @public -export interface ServersListByResourceGroupOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ServersListByResourceGroupResponse = ServerList; - -// @public -export interface ServersListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ServersListBySubscriptionNextResponse = ServerList; - -// @public -export interface ServersListBySubscriptionOptionalParams extends coreClient.OperationOptions { +export interface ServersListBySubscriptionOptionalParams extends OperationOptions { } // @public -export type ServersListBySubscriptionResponse = ServerList; - -// @public -export interface ServersRestartHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface ServersMigrateNetworkModeOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface ServersRestartOptionalParams extends coreClient.OperationOptions { +export interface ServersOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, serverName: string, parameters: Server, options?: ServersCreateOrUpdateOptionalParams) => Promise, Server>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, serverName: string, parameters: Server, options?: ServersCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, serverName: string, options?: ServersDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, serverName: string, options?: ServersDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginMigrateNetworkMode: (resourceGroupName: string, serverName: string, options?: ServersMigrateNetworkModeOptionalParams) => Promise, MigrateNetworkStatus>>; + // @deprecated (undocumented) + beginMigrateNetworkModeAndWait: (resourceGroupName: string, serverName: string, options?: ServersMigrateNetworkModeOptionalParams) => Promise; + // @deprecated (undocumented) + beginRestart: (resourceGroupName: string, serverName: string, options?: ServersRestartOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginRestartAndWait: (resourceGroupName: string, serverName: string, options?: ServersRestartOptionalParams) => Promise; + // @deprecated (undocumented) + beginStart: (resourceGroupName: string, serverName: string, options?: ServersStartOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginStartAndWait: (resourceGroupName: string, serverName: string, options?: ServersStartOptionalParams) => Promise; + // @deprecated (undocumented) + beginStop: (resourceGroupName: string, serverName: string, options?: ServersStopOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginStopAndWait: (resourceGroupName: string, serverName: string, options?: ServersStopOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, serverName: string, parameters: ServerForPatch, options?: ServersUpdateOptionalParams) => Promise, Server>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, serverName: string, parameters: ServerForPatch, options?: ServersUpdateOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, serverName: string, parameters: Server, options?: ServersCreateOrUpdateOptionalParams) => PollerLike, Server>; + delete: (resourceGroupName: string, serverName: string, options?: ServersDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, serverName: string, options?: ServersGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: ServersListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: ServersListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + migrateNetworkMode: (resourceGroupName: string, serverName: string, options?: ServersMigrateNetworkModeOptionalParams) => PollerLike, MigrateNetworkStatus>; + restart: (resourceGroupName: string, serverName: string, options?: ServersRestartOptionalParams) => PollerLike, void>; + start: (resourceGroupName: string, serverName: string, options?: ServersStartOptionalParams) => PollerLike, void>; + stop: (resourceGroupName: string, serverName: string, options?: ServersStopOptionalParams) => PollerLike, void>; + update: (resourceGroupName: string, serverName: string, parameters: ServerForPatch, options?: ServersUpdateOptionalParams) => PollerLike, Server>; +} + +// @public +export interface ServersRestartOptionalParams extends OperationOptions { parameters?: RestartParameter; - resumeFrom?: string; updateIntervalInMs?: number; } // @public -export type ServersRestartResponse = ServersRestartHeaders; - -// @public -export interface ServersStartHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface ServersStartOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ServersStartOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type ServersStartResponse = ServersStartHeaders; - -// @public -export interface ServersStopHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface ServersStopOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ServersStopOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type ServersStopResponse = ServersStopHeaders; - // @public export type ServerState = string; // @public -export interface ServersUpdateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface ServersUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface ServersUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ServerThreatProtectionSettingsCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type ServersUpdateResponse = Server; - -// @public -export interface ServerThreatProtectionSettings { - beginCreateOrUpdate(resourceGroupName: string, serverName: string, threatProtectionName: ThreatProtectionName, parameters: AdvancedThreatProtectionSettingsModel, options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams): Promise, ServerThreatProtectionSettingsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, serverName: string, threatProtectionName: ThreatProtectionName, parameters: AdvancedThreatProtectionSettingsModel, options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams): Promise; +export interface ServerThreatProtectionSettingsOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, serverName: string, threatProtectionName: ThreatProtectionName, parameters: AdvancedThreatProtectionSettingsModel, options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams) => Promise, AdvancedThreatProtectionSettingsModel>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, serverName: string, threatProtectionName: ThreatProtectionName, parameters: AdvancedThreatProtectionSettingsModel, options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, serverName: string, threatProtectionName: ThreatProtectionName, parameters: AdvancedThreatProtectionSettingsModel, options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams) => PollerLike, AdvancedThreatProtectionSettingsModel>; } // @public -export interface ServerThreatProtectionSettingsCreateOrUpdateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface ServerVersionCapability extends CapabilityBase { + readonly name?: string; + readonly supportedFeatures?: SupportedFeature[]; + readonly supportedVersionsToUpgrade?: string[]; } // @public -export interface ServerThreatProtectionSettingsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface ServiceSpecification { + readonly logSpecifications?: LogSpecification[]; + readonly metricSpecifications?: MetricSpecification[]; } // @public -export type ServerThreatProtectionSettingsCreateOrUpdateResponse = AdvancedThreatProtectionSettingsModel; - -// @public -export interface ServerVersionCapability extends CapabilityBase { - readonly name?: string; - readonly supportedFeatures?: SupportedFeature[]; - readonly supportedVersionsToUpgrade?: string[]; +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 @@ -2432,9 +2215,7 @@ export type ThreatProtectionState = "Enabled" | "Disabled"; // @public export interface TrackedResource extends Resource { location: string; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public @@ -2445,55 +2226,32 @@ export type TuningOptionParameterEnum = string; // @public export interface TuningOptions extends ProxyResource { + properties?: TuningOptionsProperties; } // @public -export interface TuningOptionsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type TuningOptionsGetResponse = TuningOptions; - -// @public -export interface TuningOptionsList { - nextLink?: string; - value?: TuningOptions[]; +export interface TuningOptionsGetOptionalParams extends OperationOptions { } // @public -export interface TuningOptionsListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface TuningOptionsListByServerOptionalParams extends OperationOptions { } // @public -export type TuningOptionsListByServerNextResponse = TuningOptionsList; - -// @public -export interface TuningOptionsListByServerOptionalParams extends coreClient.OperationOptions { +export interface TuningOptionsListRecommendationsOptionalParams extends OperationOptions { + recommendationType?: RecommendationTypeParameterEnum; } // @public -export type TuningOptionsListByServerResponse = TuningOptionsList; - -// @public -export interface TuningOptionsListRecommendationsNextOptionalParams extends coreClient.OperationOptions { +export interface TuningOptionsOperations { + get: (resourceGroupName: string, serverName: string, tuningOption: TuningOptionParameterEnum, options?: TuningOptionsGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: TuningOptionsListByServerOptionalParams) => PagedAsyncIterableIterator; + listRecommendations: (resourceGroupName: string, serverName: string, tuningOption: TuningOptionParameterEnum, options?: TuningOptionsListRecommendationsOptionalParams) => PagedAsyncIterableIterator; } // @public -export type TuningOptionsListRecommendationsNextResponse = ObjectRecommendationList; - -// @public -export interface TuningOptionsListRecommendationsOptionalParams extends coreClient.OperationOptions { - recommendationType?: RecommendationTypeParameterEnum; -} - -// @public -export type TuningOptionsListRecommendationsResponse = ObjectRecommendationList; - -// @public -export interface TuningOptionsOperations { - get(resourceGroupName: string, serverName: string, tuningOption: TuningOptionParameterEnum, options?: TuningOptionsGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: TuningOptionsListByServerOptionalParams): PagedAsyncIterableIterator; - listRecommendations(resourceGroupName: string, serverName: string, tuningOption: TuningOptionParameterEnum, options?: TuningOptionsListRecommendationsOptionalParams): PagedAsyncIterableIterator; +export interface TuningOptionsProperties { + readonly state?: string; } // @public @@ -2501,9 +2259,7 @@ export interface UserAssignedIdentity { principalId?: string; readonly tenantId?: string; type: IdentityType; - userAssignedIdentities?: { - [propertyName: string]: UserIdentity; - }; + userAssignedIdentities?: Record; } // @public @@ -2538,7 +2294,10 @@ export interface ValidationSummaryItem { } // @public -export interface VirtualEndpoint extends VirtualEndpointResourceForPatch, Resource { +export interface VirtualEndpoint extends ProxyResource { + endpointType?: VirtualEndpointType; + members?: string[]; + readonly virtualEndpoints?: string[]; } // @public @@ -2549,117 +2308,76 @@ export interface VirtualEndpointResourceForPatch { } // @public -export interface VirtualEndpoints { - beginCreate(resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpoint, options?: VirtualEndpointsCreateOptionalParams): Promise, VirtualEndpointsCreateResponse>>; - beginCreateAndWait(resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpoint, options?: VirtualEndpointsCreateOptionalParams): Promise; - beginDelete(resourceGroupName: string, serverName: string, virtualEndpointName: string, options?: VirtualEndpointsDeleteOptionalParams): Promise, VirtualEndpointsDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, serverName: string, virtualEndpointName: string, options?: VirtualEndpointsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpointResourceForPatch, options?: VirtualEndpointsUpdateOptionalParams): Promise, VirtualEndpointsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpointResourceForPatch, options?: VirtualEndpointsUpdateOptionalParams): Promise; - get(resourceGroupName: string, serverName: string, virtualEndpointName: string, options?: VirtualEndpointsGetOptionalParams): Promise; - listByServer(resourceGroupName: string, serverName: string, options?: VirtualEndpointsListByServerOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface VirtualEndpointsCreateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface VirtualEndpointResourceProperties { + endpointType?: VirtualEndpointType; + members?: string[]; + readonly virtualEndpoints?: string[]; } // @public -export interface VirtualEndpointsCreateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface VirtualEndpointsCreateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type VirtualEndpointsCreateResponse = VirtualEndpoint; - -// @public -export interface VirtualEndpointsDeleteHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; -} - -// @public -export interface VirtualEndpointsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface VirtualEndpointsDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type VirtualEndpointsDeleteResponse = VirtualEndpointsDeleteHeaders; - -// @public -export interface VirtualEndpointsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type VirtualEndpointsGetResponse = VirtualEndpoint; - -// @public -export interface VirtualEndpointsList { - nextLink?: string; - value?: VirtualEndpoint[]; -} - -// @public -export interface VirtualEndpointsListByServerNextOptionalParams extends coreClient.OperationOptions { +export interface VirtualEndpointsGetOptionalParams extends OperationOptions { } // @public -export type VirtualEndpointsListByServerNextResponse = VirtualEndpointsList; - -// @public -export interface VirtualEndpointsListByServerOptionalParams extends coreClient.OperationOptions { +export interface VirtualEndpointsListByServerOptionalParams extends OperationOptions { } // @public -export type VirtualEndpointsListByServerResponse = VirtualEndpointsList; - -// @public -export interface VirtualEndpointsUpdateHeaders { - // (undocumented) - azureAsyncOperation?: string; - // (undocumented) - location?: string; +export interface VirtualEndpointsOperations { + // @deprecated (undocumented) + beginCreate: (resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpoint, options?: VirtualEndpointsCreateOptionalParams) => Promise, VirtualEndpoint>>; + // @deprecated (undocumented) + beginCreateAndWait: (resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpoint, options?: VirtualEndpointsCreateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, serverName: string, virtualEndpointName: string, options?: VirtualEndpointsDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, serverName: string, virtualEndpointName: string, options?: VirtualEndpointsDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpointResourceForPatch, options?: VirtualEndpointsUpdateOptionalParams) => Promise, VirtualEndpoint>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpointResourceForPatch, options?: VirtualEndpointsUpdateOptionalParams) => Promise; + create: (resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpoint, options?: VirtualEndpointsCreateOptionalParams) => PollerLike, VirtualEndpoint>; + delete: (resourceGroupName: string, serverName: string, virtualEndpointName: string, options?: VirtualEndpointsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, serverName: string, virtualEndpointName: string, options?: VirtualEndpointsGetOptionalParams) => Promise; + listByServer: (resourceGroupName: string, serverName: string, options?: VirtualEndpointsListByServerOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, serverName: string, virtualEndpointName: string, parameters: VirtualEndpointResourceForPatch, options?: VirtualEndpointsUpdateOptionalParams) => PollerLike, VirtualEndpoint>; } // @public -export interface VirtualEndpointsUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface VirtualEndpointsUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type VirtualEndpointsUpdateResponse = VirtualEndpoint; - // @public export type VirtualEndpointType = string; // @public -export interface VirtualNetworkSubnetUsage { - list(locationName: string, parameters: VirtualNetworkSubnetUsageParameter, options?: VirtualNetworkSubnetUsageListOptionalParams): Promise; -} - -// @public -export interface VirtualNetworkSubnetUsageListOptionalParams extends coreClient.OperationOptions { +export interface VirtualNetworkSubnetUsageListOptionalParams extends OperationOptions { } -// @public -export type VirtualNetworkSubnetUsageListResponse = VirtualNetworkSubnetUsageModel; - // @public export interface VirtualNetworkSubnetUsageModel { + // (undocumented) readonly delegatedSubnetsUsage?: DelegatedSubnetUsage[]; readonly location?: string; readonly subscriptionId?: string; } +// @public +export interface VirtualNetworkSubnetUsageOperations { + list: (locationName: string, parameters: VirtualNetworkSubnetUsageParameter, options?: VirtualNetworkSubnetUsageListOptionalParams) => Promise; +} + // @public export interface VirtualNetworkSubnetUsageParameter { virtualNetworkArmResourceId?: string; diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraCreateOrUpdateSample.ts index c084e0f46caf..400b569c7304 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraCreateOrUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraCreateOrUpdateSample.ts @@ -1,45 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - AdministratorMicrosoftEntraAdd} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates a new server administrator associated to a Microsoft Entra principal. + * This sample demonstrates how to creates a new server administrator associated to a Microsoft Entra principal. * - * @summary Creates a new server administrator associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraAdd.json + * @summary creates a new server administrator associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraAdd.json */ async function addAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; - const parameters: AdministratorMicrosoftEntraAdd = { - principalName: "exampleuser@contoso.com", - principalType: "User", - tenantId: "tttttttt-tttt-tttt-tttt-tttttttttttt", - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.administratorsMicrosoftEntra.createOrUpdate( + "exampleresourcegroup", + "exampleserver", + "oooooooo-oooo-oooo-oooo-oooooooooooo", + { + principalName: "exampleuser@contoso.com", + principalType: "User", + tenantId: "tttttttt-tttt-tttt-tttt-tttttttttttt", + }, ); - const result = - await client.administratorsMicrosoftEntra.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - objectId, - parameters, - ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraDeleteSample.ts index c9b972b70dcf..7091cc36333c 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraDeleteSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraDeleteSample.ts @@ -3,33 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Deletes an existing server administrator associated to a Microsoft Entra principal. + * This sample demonstrates how to deletes an existing server administrator associated to a Microsoft Entra principal. * - * @summary Deletes an existing server administrator associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraDelete.json + * @summary deletes an existing server administrator associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraDelete.json */ async function deleteAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.administratorsMicrosoftEntra.delete( + "exampleresourcegroup", + "exampleserver", + "oooooooo-oooo-oooo-oooo-oooooooooooo", ); - const result = await client.administratorsMicrosoftEntra.beginDeleteAndWait( - resourceGroupName, - serverName, - objectId, - ); - console.log(result); } async function main(): Promise { diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraGetSample.ts index e452c6bf2baa..d152d8a99651 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraGetSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets information about a server administrator associated to a Microsoft Entra principal. + * This sample demonstrates how to gets information about a server administrator associated to a Microsoft Entra principal. * - * @summary Gets information about a server administrator associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraGet.json + * @summary gets information about a server administrator associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraGet.json */ async function getInformationAboutAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.administratorsMicrosoftEntra.get( - resourceGroupName, - serverName, - objectId, + "exampleresourcegroup", + "exampleserver", + "oooooooo-oooo-oooo-oooo-oooooooooooo", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraListByServerSample.ts index 9bcb8b999144..97fe86f231c0 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/administratorsMicrosoftEntraListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List all server administrators associated to a Microsoft Entra principal. + * This sample demonstrates how to list all server administrators associated to a Microsoft Entra principal. * - * @summary List all server administrators associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraListByServer.json + * @summary list all server administrators associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraListByServer.json */ async function listInformationAboutAllServerAdministratorsAssociatedToMicrosoftEntraPrincipals(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.administratorsMicrosoftEntra.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/advancedThreatProtectionSettingsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/advancedThreatProtectionSettingsGetSample.ts index bd3f5e18a878..815920192c85 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/advancedThreatProtectionSettingsGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/advancedThreatProtectionSettingsGetSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets state of advanced threat protection settings for a server. + * This sample demonstrates how to gets state of advanced threat protection settings for a server. * - * @summary Gets state of advanced threat protection settings for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsGet.json + * @summary gets state of advanced threat protection settings for a server. + * x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsGet.json */ async function getStateOfAdvancedThreatProtectionSettingsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const threatProtectionName = "Default"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.advancedThreatProtectionSettings.get( - resourceGroupName, - serverName, - threatProtectionName, + "exampleresourcegroup", + "exampleserver", + "Default", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/advancedThreatProtectionSettingsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/advancedThreatProtectionSettingsListByServerSample.ts index 424ce6d901e2..61540e82a51a 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/advancedThreatProtectionSettingsListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/advancedThreatProtectionSettingsListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists state of advanced threat protection settings for a server. + * This sample demonstrates how to lists state of advanced threat protection settings for a server. * - * @summary Lists state of advanced threat protection settings for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsListByServer.json + * @summary lists state of advanced threat protection settings for a server. + * x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsListByServer.json */ async function listStateOfAdvancedThreatProtectionSettingsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.advancedThreatProtectionSettings.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandCreateSample.ts index 63113c61cf49..986d1d299c82 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandCreateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandCreateSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates an on demand backup of a server. + * This sample demonstrates how to creates an on demand backup of a server. * - * @summary Creates an on demand backup of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandCreate.json + * @summary creates an on demand backup of a server. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandCreate.json */ async function createAnOnDemandBackupOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "ondemandbackup-20250601T183022"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.backupsAutomaticAndOnDemand.beginCreateAndWait( - resourceGroupName, - serverName, - backupName, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.backupsAutomaticAndOnDemand.create( + "exampleresourcegroup", + "exampleserver", + "ondemandbackup-20250601T183022", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandDeleteSample.ts index e233f66befd9..4717aa593fb5 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandDeleteSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandDeleteSample.ts @@ -3,33 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Deletes a specific backup, given its name. + * This sample demonstrates how to deletes a specific backup, given its name. * - * @summary Deletes a specific backup, given its name. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandDelete.json + * @summary deletes a specific backup, given its name. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandDelete.json */ async function deleteAnOnDemandBackupGivenItsName(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "ondemandbackup-20250601T183022"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.backupsAutomaticAndOnDemand.delete( + "exampleresourcegroup", + "exampleserver", + "ondemandbackup-20250601T183022", ); - const result = await client.backupsAutomaticAndOnDemand.beginDeleteAndWait( - resourceGroupName, - serverName, - backupName, - ); - console.log(result); } async function main(): Promise { diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandGetSample.ts index 47f839ed9d4a..818142fc654a 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandGetSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets information of an on demand backup, given its name. + * This sample demonstrates how to gets information of an on demand backup, given its name. * - * @summary Gets information of an on demand backup, given its name. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandGet.json + * @summary gets information of an on demand backup, given its name. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandGet.json */ async function getAnOnDemandBackupGivenItsName(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "backup_638830782181266873"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.backupsAutomaticAndOnDemand.get( - resourceGroupName, - serverName, - backupName, + "exampleresourcegroup", + "exampleserver", + "backup_638830782181266873", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandListByServerSample.ts index 280eef99fd6e..1dfe364676e8 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsAutomaticAndOnDemandListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all available backups of a server. + * This sample demonstrates how to lists all available backups of a server. * - * @summary Lists all available backups of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandListByServer.json + * @summary lists all available backups of a server. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandListByServer.json */ async function listAllAvailableBackupsOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.backupsAutomaticAndOnDemand.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionCheckPrerequisitesSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionCheckPrerequisitesSample.ts index cec7b338be48..eba1eecbdc85 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionCheckPrerequisitesSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionCheckPrerequisitesSample.ts @@ -1,39 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - LtrPreBackupRequest} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Performs all checks required for a long term retention backup operation to succeed. + * This sample demonstrates how to performs all checks required for a long term retention backup operation to succeed. * - * @summary Performs all checks required for a long term retention backup operation to succeed. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionCheckPrerequisites.json + * @summary performs all checks required for a long term retention backup operation to succeed. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionCheckPrerequisites.json */ async function performAllChecksRequiredForALongTermRetentionBackupOperationToSucceed(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: LtrPreBackupRequest = { - backupSettings: { backupName: "exampleltrbackup" }, - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.backupsLongTermRetention.checkPrerequisites( - resourceGroupName, - serverName, - parameters, + "exampleresourcegroup", + "exampleserver", + { backupSettings: { backupName: "exampleltrbackup" } }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionGetSample.ts index 7532c17cf2a3..314c348a201f 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionGetSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the results of a long retention backup operation for a server. + * This sample demonstrates how to gets the results of a long retention backup operation for a server. * - * @summary Gets the results of a long retention backup operation for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionGet.json + * @summary gets the results of a long retention backup operation for a server. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionGet.json */ async function getTheResultsOfALongRetentionBackupOperationForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "exampleltrbackup"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.backupsLongTermRetention.get( - resourceGroupName, - serverName, - backupName, + "exampleresourcegroup", + "exampleserver", + "exampleltrbackup", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionListByServerSample.ts index 705af0e90971..47d2232a8fe1 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the results of the long term retention backup operations for a server. + * This sample demonstrates how to lists the results of the long term retention backup operations for a server. * - * @summary Lists the results of the long term retention backup operations for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionListByServer.json + * @summary lists the results of the long term retention backup operations for a server. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionListByServer.json */ async function listTheResultsOfTheLongTermRetentionBackupOperationsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.backupsLongTermRetention.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionStartSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionStartSample.ts index 9ea3ebfd0523..89a085c27ca5 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionStartSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/backupsLongTermRetentionStartSample.ts @@ -1,40 +1,26 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - BackupsLongTermRetentionRequest} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Initiates a long term retention backup. + * This sample demonstrates how to initiates a long term retention backup. * - * @summary Initiates a long term retention backup. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionStart.json + * @summary initiates a long term retention backup. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionStart.json */ async function initiateALongTermRetentionBackup(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: BackupsLongTermRetentionRequest = { - backupSettings: { backupName: "exampleltrbackup" }, - targetDetails: { sasUriList: ["sasuri"] }, - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.backupsLongTermRetention.beginStartAndWait( - resourceGroupName, - serverName, - parameters, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.backupsLongTermRetention.start( + "exampleresourcegroup", + "exampleserver", + { + backupSettings: { backupName: "exampleltrbackup" }, + targetDetails: { sasUriList: ["sasuri"] }, + }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/capabilitiesByLocationListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/capabilitiesByLocationListSample.ts index abbbf80ade20..6430184fb320 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/capabilitiesByLocationListSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/capabilitiesByLocationListSample.ts @@ -3,28 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the capabilities available in a given location for a specific subscription. + * This sample demonstrates how to lists the capabilities available in a given location for a specific subscription. * - * @summary Lists the capabilities available in a given location for a specific subscription. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByLocationList.json + * @summary lists the capabilities available in a given location for a specific subscription. + * x-ms-original-file: 2026-01-01-preview/CapabilitiesByLocationList.json */ async function listTheCapabilitiesAvailableInAGivenLocationForASpecificSubscription(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.capabilitiesByLocation.list(locationName)) { + for await (const item of client.capabilitiesByLocation.list("eastus")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/capabilitiesByServerListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/capabilitiesByServerListSample.ts index 0d5116992da2..1687ec8e1c5b 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/capabilitiesByServerListSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/capabilitiesByServerListSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the capabilities available for a given server. + * This sample demonstrates how to lists the capabilities available for a given server. * - * @summary Lists the capabilities available for a given server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByServerList.json + * @summary lists the capabilities available for a given server. + * x-ms-original-file: 2026-01-01-preview/CapabilitiesByServerList.json */ async function listTheCapabilitiesAvailableForAGivenServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.capabilitiesByServer.list( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/capturedLogsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/capturedLogsListByServerSample.ts index 87744a907626..d718f3dc5572 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/capturedLogsListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/capturedLogsListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all captured logs for download in a server. + * This sample demonstrates how to lists all captured logs for download in a server. * - * @summary Lists all captured logs for download in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapturedLogsListByServer.json + * @summary lists all captured logs for download in a server. + * x-ms-original-file: 2026-01-01-preview/CapturedLogsListByServer.json */ async function listAllCapturedLogsForDownloadInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.capturedLogs.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsGetSample.ts index 4724f5dc2791..6d78f414e3b1 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsGetSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets information about a specific configuration (also known as server parameter) of a server. + * This sample demonstrates how to gets information about a specific configuration (also known as server parameter) of a server. * - * @summary Gets information about a specific configuration (also known as server parameter) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsGet.json + * @summary gets information about a specific configuration (also known as server parameter) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsGet.json */ async function getInformationAboutASpecificConfigurationAlsoKnownAsServerParameterOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const configurationName = "array_nulls"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.configurations.get( - resourceGroupName, - serverName, - configurationName, + "exampleresourcegroup", + "exampleserver", + "array_nulls", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsListByServerSample.ts index 6227395602c2..caece9e0e863 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all configurations (also known as server parameters) of a server. + * This sample demonstrates how to lists all configurations (also known as server parameters) of a server. * - * @summary Lists all configurations (also known as server parameters) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsListByServer.json + * @summary lists all configurations (also known as server parameters) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsListByServer.json */ async function listAllConfigurationsAlsoKnownAsServerParametersOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.configurations.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsPutSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsPutSample.ts index 53f9378f4ddf..dbc629362897 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsPutSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsPutSample.ts @@ -1,42 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - ConfigurationForUpdate} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * This sample demonstrates how to updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. * - * @summary Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdateUsingPut.json + * @summary updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdateUsingPut.json */ async function updateUsingPutVerbTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const configurationName = "constraint_exclusion"; - const parameters: ConfigurationForUpdate = { - source: "user-override", - value: "on", - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.configurations.beginPutAndWait( - resourceGroupName, - serverName, - configurationName, - parameters, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.configurations.put( + "exampleresourcegroup", + "exampleserver", + "constraint_exclusion", + { source: "user-override", value: "on" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsUpdateSample.ts index 92333f04cff6..31ee174dcd7c 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/configurationsUpdateSample.ts @@ -1,42 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - ConfigurationForUpdate} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * This sample demonstrates how to updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. * - * @summary Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdate.json + * @summary updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdate.json */ async function updateTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const configurationName = "constraint_exclusion"; - const parameters: ConfigurationForUpdate = { - source: "user-override", - value: "on", - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.configurations.beginUpdateAndWait( - resourceGroupName, - serverName, - configurationName, - parameters, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.configurations.update( + "exampleresourcegroup", + "exampleserver", + "constraint_exclusion", + { source: "user-override", value: "on" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesCreateSample.ts index c8e06b4960c6..079cb1a7361f 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesCreateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesCreateSample.ts @@ -1,39 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - Database} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates a new database. + * This sample demonstrates how to creates a new database. * - * @summary Creates a new database. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesCreate.json + * @summary creates a new database. + * x-ms-original-file: 2026-01-01-preview/DatabasesCreate.json */ async function createADatabase(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const databaseName = "exampledatabase"; - const parameters: Database = { charset: "utf8", collation: "en_US.utf8" }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.databases.beginCreateAndWait( - resourceGroupName, - serverName, - databaseName, - parameters, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.databases.create( + "exampleresourcegroup", + "exampleserver", + "exampledatabase", + { charset: "utf8", collation: "en_US.utf8" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesDeleteSample.ts index a4345094366e..ac4fb23606c0 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesDeleteSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesDeleteSample.ts @@ -3,33 +3,18 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Deletes an existing database. + * This sample demonstrates how to deletes an existing database. * - * @summary Deletes an existing database. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesDelete.json + * @summary deletes an existing database. + * x-ms-original-file: 2026-01-01-preview/DatabasesDelete.json */ async function deleteAnExistingDatabase(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const databaseName = "exampledatabase"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.databases.beginDeleteAndWait( - resourceGroupName, - serverName, - databaseName, - ); - console.log(result); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.databases.delete("exampleresourcegroup", "exampleserver", "exampledatabase"); } async function main(): Promise { diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesGetSample.ts index 6fbc0fc0b189..e099a042e983 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesGetSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets information about an existing database. + * This sample demonstrates how to gets information about an existing database. * - * @summary Gets information about an existing database. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesGet.json + * @summary gets information about an existing database. + * x-ms-original-file: 2026-01-01-preview/DatabasesGet.json */ async function getInformationAboutAnExistingDatabase(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const databaseName = "exampledatabase"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.databases.get( - resourceGroupName, - serverName, - databaseName, + "exampleresourcegroup", + "exampleserver", + "exampledatabase", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesListByServerSample.ts index 00f27f511229..7f13e8bacc1d 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/databasesListByServerSample.ts @@ -3,33 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all databases in a server. + * This sample demonstrates how to lists all databases in a server. * - * @summary Lists all databases in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesListByServer.json + * @summary lists all databases in a server. + * x-ms-original-file: 2026-01-01-preview/DatabasesListByServer.json */ async function listAllDatabasesInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.databases.listByServer( - resourceGroupName, - serverName, - )) { + for await (const item of client.databases.listByServer("exampleresourcegroup", "exampleserver")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesCreateOrUpdateSample.ts index d11c109ee19d..c8db1118e434 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesCreateOrUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesCreateOrUpdateSample.ts @@ -1,42 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - FirewallRule} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates a new firewall rule or updates an existing firewall rule. + * This sample demonstrates how to creates a new firewall rule or updates an existing firewall rule. * - * @summary Creates a new firewall rule or updates an existing firewall rule. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesCreateOrUpdate.json + * @summary creates a new firewall rule or updates an existing firewall rule. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesCreateOrUpdate.json */ async function createANewFirewallRuleOrUpdateAnExistingFirewallRule(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const firewallRuleName = "examplefirewallrule"; - const parameters: FirewallRule = { - endIpAddress: "255.255.255.255", - startIpAddress: "0.0.0.0", - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.firewallRules.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - firewallRuleName, - parameters, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.firewallRules.createOrUpdate( + "exampleresourcegroup", + "exampleserver", + "examplefirewallrule", + { endIpAddress: "255.255.255.255", startIpAddress: "0.0.0.0" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesDeleteSample.ts index 798ccea0f02f..370ee5ac1bc0 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesDeleteSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesDeleteSample.ts @@ -3,33 +3,18 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Deletes an existing firewall rule. + * This sample demonstrates how to deletes an existing firewall rule. * - * @summary Deletes an existing firewall rule. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesDelete.json + * @summary deletes an existing firewall rule. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesDelete.json */ async function deleteAnExistingFirewallRule(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const firewallRuleName = "examplefirewallrule"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.firewallRules.beginDeleteAndWait( - resourceGroupName, - serverName, - firewallRuleName, - ); - console.log(result); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.firewallRules.delete("exampleresourcegroup", "exampleserver", "examplefirewallrule"); } async function main(): Promise { diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesGetSample.ts index 1df2b7cbe469..c16d148a9657 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesGetSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets information about a firewall rule in a server. + * This sample demonstrates how to gets information about a firewall rule in a server. * - * @summary Gets information about a firewall rule in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesGet.json + * @summary gets information about a firewall rule in a server. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesGet.json */ async function getInformationAboutAFirewallRuleInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const firewallRuleName = "examplefirewallrule"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.firewallRules.get( - resourceGroupName, - serverName, - firewallRuleName, + "exampleresourcegroup", + "exampleserver", + "examplefirewallrule", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesListByServerSample.ts index 6caff86dbf75..eb6633967c22 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/firewallRulesListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists information about all firewall rules in a server. + * This sample demonstrates how to lists information about all firewall rules in a server. * - * @summary Lists information about all firewall rules in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesListByServer.json + * @summary lists information about all firewall rules in a server. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesListByServer.json */ async function listInformationAboutAllFirewallRulesInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.firewallRules.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCancelSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCancelSample.ts index 58341bdf3e82..b1b43dafb272 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCancelSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCancelSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Cancels an active migration. + * This sample demonstrates how to cancels an active migration. * - * @summary Cancels an active migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCancel.json + * @summary cancels an active migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCancel.json */ async function cancelAnActiveMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.cancel( - resourceGroupName, - serverName, - migrationName, + "exampleresourcegroup", + "exampleserver", + "examplemigration", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCheckNameAvailabilitySample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCheckNameAvailabilitySample.ts index cfd2c1a0eeeb..abccc250d18e 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCheckNameAvailabilitySample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCheckNameAvailabilitySample.ts @@ -1,40 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - MigrationNameAvailability} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Checks if a proposed migration name is valid and available. + * This sample demonstrates how to checks if a proposed migration name is valid and available. * - * @summary Checks if a proposed migration name is valid and available. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCheckNameAvailability.json + * @summary checks if a proposed migration name is valid and available. + * x-ms-original-file: 2026-01-01-preview/MigrationsCheckNameAvailability.json */ async function checkTheValidityAndAvailabilityOfTheGivenNameToAssignItToANewMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: MigrationNameAvailability = { - name: "examplemigration", - type: "Microsoft.DBforPostgreSQL/flexibleServers/migrations", - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.checkNameAvailability( - resourceGroupName, - serverName, - parameters, + "exampleresourcegroup", + "exampleserver", + { name: "examplemigration", type: "Microsoft.DBforPostgreSQL/flexibleServers/migrations" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCreateSample.ts index fbe524b7d2ce..13f452cae7f2 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCreateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsCreateSample.ts @@ -1,360 +1,282 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - Migration} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates a new migration. + * This sample demonstrates how to creates a new migration. * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateValidateOnly.json + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreate.json */ -async function createAMigrationForValidatingOnly(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - migrationOption: "Validate", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; +async function createAMigration(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, ); console.log(result); } /** - * This sample demonstrates how to Creates a new migration. + * This sample demonstrates how to creates a new migration. * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithOtherUsers.json + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateOtherSourceTypesValidateMigrate.json */ -async function createAMigrationSpecifyingUserNames(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - sourceServerUsername: "newadmin@examplesource", - targetServerUsername: "targetadmin", - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; +async function createAMigrationWithOtherSourceTypeForValidatingAndMigrating(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + migrationOption: "ValidateAndMigrate", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: "examplesource:5432@exampleuser", + sourceType: "OnPremises", + sslMode: "Prefer", + }, ); console.log(result); } /** - * This sample demonstrates how to Creates a new migration. + * This sample demonstrates how to creates a new migration. * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithFullyQualifiedDomainName.json + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateValidateOnly.json */ -async function createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "xxxxxxxx", - targetServerPassword: "xxxxxxxx", - }, - }, - sourceDbServerFullyQualifiedDomainName: "examplesource.contoso.com", - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - targetDbServerFullyQualifiedDomainName: "exampletarget.contoso.com", - }; +async function createAMigrationForValidatingOnly(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + migrationOption: "Validate", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, ); console.log(result); } /** - * This sample demonstrates how to Creates a new migration. + * This sample demonstrates how to creates a new migration. * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateOtherSourceTypesValidateMigrate.json + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithFullyQualifiedDomainName.json */ -async function createAMigrationWithOtherSourceTypeForValidatingAndMigrating(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - migrationOption: "ValidateAndMigrate", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: "examplesource:5432@exampleuser", - sourceType: "OnPremises", - sslMode: "Prefer", - }; +async function createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { sourceServerPassword: "xxxxxxxx", targetServerPassword: "xxxxxxxx" }, + }, + sourceDbServerFullyQualifiedDomainName: "examplesource.contoso.com", + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + targetDbServerFullyQualifiedDomainName: "exampletarget.contoso.com", + }, ); console.log(result); } /** - * This sample demonstrates how to Creates a new migration. + * This sample demonstrates how to creates a new migration. * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithPrivateEndpointServers.json + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithOtherUsers.json */ -async function createAMigrationWithPrivateEndpoint(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationInstanceResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/examplesourcemigration", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; +async function createAMigrationSpecifyingUserNames(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + sourceServerUsername: "newadmin@examplesource", + targetServerUsername: "targetadmin", + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, ); console.log(result); } /** - * This sample demonstrates how to Creates a new migration. + * This sample demonstrates how to creates a new migration. * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithRoles.json + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithPrivateEndpointServers.json */ -async function createAMigrationWithRoles(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrateRoles: "True", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; +async function createAMigrationWithPrivateEndpoint(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationInstanceResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/examplesourcemigration", + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, ); console.log(result); } /** - * This sample demonstrates how to Creates a new migration. + * This sample demonstrates how to creates a new migration. * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreate.json + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithRoles.json */ -async function createAMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; +async function createAMigrationWithRoles(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrateRoles: "True", + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, ); console.log(result); } async function main(): Promise { + await createAMigration(); + await createAMigrationWithOtherSourceTypeForValidatingAndMigrating(); await createAMigrationForValidatingOnly(); - await createAMigrationSpecifyingUserNames(); await createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers(); - await createAMigrationWithOtherSourceTypeForValidatingAndMigrating(); + await createAMigrationSpecifyingUserNames(); await createAMigrationWithPrivateEndpoint(); await createAMigrationWithRoles(); - await createAMigration(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsGetSample.ts index 90a41d4eeb1d..fa5a583481c0 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsGetSample.ts @@ -3,149 +3,103 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets information about a migration. + * This sample demonstrates how to gets information about a migration. * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationAndMigration.json + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGet.json */ -async function getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; +async function getInformationAboutAMigration(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, + "exampleresourcegroup", + "exampleserver", + "examplemigration", ); console.log(result); } /** - * This sample demonstrates how to Gets information about a migration. + * This sample demonstrates how to gets information about a migration. * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationButMigrationFailure.json + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithSuccessfulValidationAndMigration.json */ -async function getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; +async function getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, + "exampleresourcegroup", + "exampleserver", + "examplemigration", ); console.log(result); } /** - * This sample demonstrates how to Gets information about a migration. + * This sample demonstrates how to gets information about a migration. * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationOnly.json + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithSuccessfulValidationButMigrationFailure.json */ -async function getInformationAboutAMigrationWithSuccessfulValidationOnly(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; +async function getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, + "exampleresourcegroup", + "exampleserver", + "examplemigration", ); console.log(result); } /** - * This sample demonstrates how to Gets information about a migration. + * This sample demonstrates how to gets information about a migration. * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithValidationFailures.json + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithSuccessfulValidationOnly.json */ -async function getInformationAboutAMigrationWithValidationFailures(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; +async function getInformationAboutAMigrationWithSuccessfulValidationOnly(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, + "exampleresourcegroup", + "exampleserver", + "examplemigration", ); console.log(result); } /** - * This sample demonstrates how to Gets information about a migration. + * This sample demonstrates how to gets information about a migration. * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGet.json + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithValidationFailures.json */ -async function getInformationAboutAMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; +async function getInformationAboutAMigrationWithValidationFailures(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, + "exampleresourcegroup", + "exampleserver", + "examplemigration", ); console.log(result); } async function main(): Promise { + await getInformationAboutAMigration(); await getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration(); await getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration(); await getInformationAboutAMigrationWithSuccessfulValidationOnly(); await getInformationAboutAMigrationWithValidationFailures(); - await getInformationAboutAMigration(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsListByTargetServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsListByTargetServerSample.ts index 581f1abc26fe..2ba38f875a60 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsListByTargetServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsListByTargetServerSample.ts @@ -1,44 +1,28 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - MigrationsListByTargetServerOptionalParams} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all migrations of a target flexible server. + * This sample demonstrates how to lists all migrations of a target flexible server. * - * @summary Lists all migrations of a target flexible server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsListByTargetServer.json + * @summary lists all migrations of a target flexible server. + * x-ms-original-file: 2026-01-01-preview/MigrationsListByTargetServer.json */ async function listAllMigrationsOfATargetFlexibleServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationListFilter = "All"; - const options: MigrationsListByTargetServerOptionalParams = { - migrationListFilter, - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.migrations.listByTargetServer( - resourceGroupName, - serverName, - options, + "exampleresourcegroup", + "exampleserver", + { migrationListFilter: "All" }, )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsUpdateSample.ts index ae92d66fbd6b..c62914c13081 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/migrationsUpdateSample.ts @@ -1,41 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - MigrationResourceForPatch} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. + * This sample demonstrates how to updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. * - * @summary Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsUpdate.json + * @summary updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. + * x-ms-original-file: 2026-01-01-preview/MigrationsUpdate.json */ async function updateAnExistingMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: MigrationResourceForPatch = { - setupLogicalReplicationOnSourceDbIfNeeded: "True", - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.update( - resourceGroupName, - serverName, - migrationName, - parameters, + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { setupLogicalReplicationOnSourceDbIfNeeded: "True" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/nameAvailabilityCheckGloballySample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/nameAvailabilityCheckGloballySample.ts index 47b27a49e946..8838c4c10841 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/nameAvailabilityCheckGloballySample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/nameAvailabilityCheckGloballySample.ts @@ -1,34 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - CheckNameAvailabilityRequest} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + * This sample demonstrates how to checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. * - * @summary Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckGlobally.json + * @summary checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + * x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckGlobally.json */ async function checkTheValidityAndAvailabilityOfTheGivenNameToAssignItToANewServerOrToUseItAsTheBaseNameOfANewPairOfVirtualEndpoints(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const parameters: CheckNameAvailabilityRequest = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.nameAvailability.checkGlobally({ name: "exampleserver", type: "Microsoft.DBforPostgreSQL/flexibleServers", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.nameAvailability.checkGlobally(parameters); + }); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/nameAvailabilityCheckWithLocationSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/nameAvailabilityCheckWithLocationSample.ts index c7f515faafdf..4793c182c42f 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/nameAvailabilityCheckWithLocationSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/nameAvailabilityCheckWithLocationSample.ts @@ -1,38 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - CheckNameAvailabilityRequest} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Check the availability of name for resource + * This sample demonstrates how to check the availability of name for resource * - * @summary Check the availability of name for resource - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckWithLocation.json + * @summary check the availability of name for resource + * x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckWithLocation.json */ async function checkTheValidityAndAvailabilityOfTheGivenNameInTheGivenLocationToAssignItToANewServerOrToUseItAsTheBaseNameOfANewPairOfVirtualEndpoints(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; - const parameters: CheckNameAvailabilityRequest = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.nameAvailability.checkWithLocation("eastus", { name: "exampleserver", type: "Microsoft.DBforPostgreSQL/flexibleServers", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.nameAvailability.checkWithLocation( - locationName, - parameters, - ); + }); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/operationsListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/operationsListSample.ts index dabec6104b06..2a59f174f143 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/operationsListSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/operationsListSample.ts @@ -3,32 +3,26 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all available REST API operations. + * This sample demonstrates how to lists all available REST API operations. * - * @summary Lists all available REST API operations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/OperationsList.json + * @summary lists all available REST API operations. + * x-ms-original-file: 2026-01-01-preview/OperationsList.json */ -async function listAllAvailableRestApiOperations(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; +async function listAllAvailableRestAPIOperations(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const client = new PostgreSQLManagementFlexibleServerClient(credential); const resArray = new Array(); for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - await listAllAvailableRestApiOperations(); + await listAllAvailableRestAPIOperations(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateDnsZoneSuffixGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateDnsZoneSuffixGetSample.ts index 612a3859c504..2b8a0d97f8c4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateDnsZoneSuffixGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateDnsZoneSuffixGetSample.ts @@ -3,15 +3,14 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the private DNS zone suffix. + * This sample demonstrates how to gets the private DNS zone suffix. * - * @summary Gets the private DNS zone suffix. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateDnsZoneSuffixGet.json + * @summary gets the private DNS zone suffix. + * x-ms-original-file: 2026-01-01-preview/PrivateDnsZoneSuffixGet.json */ -async function getThePrivateDnsSuffix(): Promise { +async function getThePrivateDNSSuffix(): Promise { const credential = new DefaultAzureCredential(); const client = new PostgreSQLManagementFlexibleServerClient(credential); const result = await client.privateDnsZoneSuffix.get(); @@ -19,7 +18,7 @@ async function getThePrivateDnsSuffix(): Promise { } async function main(): Promise { - await getThePrivateDnsSuffix(); + await getThePrivateDNSSuffix(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsDeleteSample.ts index c70950b49854..df3ee66e7aa8 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsDeleteSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsDeleteSample.ts @@ -3,34 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Deletes a private endpoint connection. + * This sample demonstrates how to deletes a private endpoint connection. * - * @summary Deletes a private endpoint connection. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsDelete.json + * @summary deletes a private endpoint connection. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsDelete.json */ async function deleteAPrivateEndpointConnection(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const privateEndpointConnectionName = - "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.privateEndpointConnections.delete( + "exampleresourcegroup", + "exampleserver", + "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", ); - const result = await client.privateEndpointConnections.beginDeleteAndWait( - resourceGroupName, - serverName, - privateEndpointConnectionName, - ); - console.log(result); } async function main(): Promise { diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsGetSample.ts index 07eaf85c7fb9..e9dad0136eb7 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsGetSample.ts @@ -3,32 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets a private endpoint connection. + * This sample demonstrates how to gets a private endpoint connection. * - * @summary Gets a private endpoint connection. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsGet.json + * @summary gets a private endpoint connection. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsGet.json */ async function getAPrivateEndpointConnection(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const privateEndpointConnectionName = - "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.privateEndpointConnections.get( - resourceGroupName, - serverName, - privateEndpointConnectionName, + "exampleresourcegroup", + "exampleserver", + "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsListByServerSample.ts index c401c5698fbd..7c3462ecabc1 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all private endpoint connections on a server. + * This sample demonstrates how to lists all private endpoint connections on a server. * - * @summary Lists all private endpoint connections on a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsList.json + * @summary lists all private endpoint connections on a server. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsList.json */ async function listAllPrivateEndpointConnectionsOnAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.privateEndpointConnections.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsUpdateSample.ts index 98ce24773a9e..a6179a127b6e 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateEndpointConnectionsUpdateSample.ts @@ -1,45 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - PrivateEndpointConnection} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Approves or rejects a private endpoint connection. + * This sample demonstrates how to approves or rejects a private endpoint connection. * - * @summary Approves or rejects a private endpoint connection. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsUpdate.json + * @summary approves or rejects a private endpoint connection. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsUpdate.json */ async function approveOrRejectAPrivateEndpointConnection(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const privateEndpointConnectionName = - "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e"; - const parameters: PrivateEndpointConnection = { - privateLinkServiceConnectionState: { - description: "Approved by johndoe@contoso.com", - status: "Approved", - }, - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.privateEndpointConnections.beginUpdateAndWait( - resourceGroupName, - serverName, - privateEndpointConnectionName, - parameters, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.update( + "exampleresourcegroup", + "exampleserver", + "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", + { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@contoso.com", + status: "Approved", + }, + }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateLinkResourcesGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateLinkResourcesGetSample.ts index 9485f508ccad..411a5fd829b4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateLinkResourcesGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateLinkResourcesGetSample.ts @@ -3,37 +3,27 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets a private link resource for PostgreSQL server. + * This sample demonstrates how to gets a private link resource for PostgreSQL server. * - * @summary Gets a private link resource for PostgreSQL server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesGet.json + * @summary gets a private link resource for PostgreSQL server. + * x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesGet.json */ -async function getsAPrivateLinkResourceForPostgreSql(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const groupName = "exampleprivatelink"; +async function getsAPrivateLinkResourceForPostgreSQL(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.privateLinkResources.get( - resourceGroupName, - serverName, - groupName, + "exampleresourcegroup", + "exampleserver", + "exampleprivatelink", ); console.log(result); } async function main(): Promise { - await getsAPrivateLinkResourceForPostgreSql(); + await getsAPrivateLinkResourceForPostgreSQL(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateLinkResourcesListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateLinkResourcesListByServerSample.ts index 9cbdd634d941..bca779ae5413 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateLinkResourcesListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/privateLinkResourcesListByServerSample.ts @@ -3,38 +3,30 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the private link resources for PostgreSQL server. + * This sample demonstrates how to gets the private link resources for PostgreSQL server. * - * @summary Gets the private link resources for PostgreSQL server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesList.json + * @summary gets the private link resources for PostgreSQL server. + * x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesList.json */ -async function getsPrivateLinkResourcesForPostgreSql(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; +async function getsPrivateLinkResourcesForPostgreSQL(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.privateLinkResources.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - await getsPrivateLinkResourcesForPostgreSql(); + await getsPrivateLinkResourcesForPostgreSQL(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/quotaUsagesListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/quotaUsagesListSample.ts index 94f1f00006a8..63e0141f3c5e 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/quotaUsagesListSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/quotaUsagesListSample.ts @@ -3,28 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get quota usages at specified location in a given subscription. + * This sample demonstrates how to get quota usages at specified location in a given subscription. * - * @summary Get quota usages at specified location in a given subscription. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/QuotaUsagesForFlexibleServers.json + * @summary get quota usages at specified location in a given subscription. + * x-ms-original-file: 2026-01-01-preview/QuotaUsagesForFlexibleServers.json */ async function listOfQuotaUsagesForServers(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.quotaUsages.list(locationName)) { + for await (const item of client.quotaUsages.list("eastus")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/replicasListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/replicasListByServerSample.ts index cb0976981bd2..d45f577fed56 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/replicasListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/replicasListByServerSample.ts @@ -3,33 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all read replicas of a server. + * This sample demonstrates how to lists all read replicas of a server. * - * @summary Lists all read replicas of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ReplicasListByServer.json + * @summary lists all read replicas of a server. + * x-ms-original-file: 2026-01-01-preview/ReplicasListByServer.json */ async function listAllReadReplicasOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.replicas.listByServer( - resourceGroupName, - serverName, - )) { + for await (const item of client.replicas.listByServer("exampleresourcegroup", "exampleserver")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serverThreatProtectionSettingsCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serverThreatProtectionSettingsCreateOrUpdateSample.ts index bbd782798e60..ff2354a13076 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serverThreatProtectionSettingsCreateOrUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serverThreatProtectionSettingsCreateOrUpdateSample.ts @@ -1,43 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - AdvancedThreatProtectionSettingsModel} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates or updates a server's Advanced Threat Protection settings. + * This sample demonstrates how to creates or updates a server's Advanced Threat Protection settings. * - * @summary Creates or updates a server's Advanced Threat Protection settings. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsCreateOrUpdate.json + * @summary creates or updates a server's Advanced Threat Protection settings. + * x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsCreateOrUpdate.json */ async function updateTheAdvancedThreatProtectionSettingsOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const threatProtectionName = "Default"; - const parameters: AdvancedThreatProtectionSettingsModel = { - state: "Enabled", - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.serverThreatProtectionSettings.createOrUpdate( + "exampleresourcegroup", + "exampleserver", + "Default", + { state: "Enabled" }, ); - const result = - await client.serverThreatProtectionSettings.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - threatProtectionName, - parameters, - ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversCreateOrUpdateSample.ts index f26990b65909..56bea0d208a5 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversCreateOrUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversCreateOrUpdateSample.ts @@ -1,374 +1,267 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - Server} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersClusterCreate.json */ async function createANewElasticCluster(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", administratorLogin: "examplelogin", administratorLoginPassword: "examplepassword", backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" }, cluster: { clusterSize: 2, defaultDatabaseName: "clusterdb" }, createMode: "Create", highAvailability: { mode: "Disabled" }, - location: "eastus", network: { publicNetworkAccess: "Disabled" }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 256, tier: "P15" }, version: "16", - }; + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new server. + * + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateGeoRestoreWithDataEncryptionEnabled.json + */ +async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", + createMode: "GeoRestore", + dataEncryption: { + type: "AzureKeyVault", + geoBackupKeyURI: + "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", + geoBackupUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + primaryKeyURI: + "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + primaryUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + }, + pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), + sourceServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new server. + * + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json + */ +async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", + createMode: "GeoRestore", + dataEncryption: { + type: "AzureKeyVault", + geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", + geoBackupUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + primaryUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + }, + pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), + sourceServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json */ async function createANewServerInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", backup: { backupRetentionDays: 7, geoRedundantBackup: "Enabled" }, createMode: "Create", highAvailability: { mode: "ZoneRedundant" }, - location: "eastus", network: { publicNetworkAccess: "Enabled" }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, - tags: { inCustomerVnet: "false", inMicrosoftVnet: "true" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + tags: { InCustomerVnet: "false", InMicrosoftVnet: "true" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json */ async function createANewServerInYourOwnVirtualNetworkWithSameZoneHighAvailability(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", backup: { backupRetentionDays: 7, geoRedundantBackup: "Enabled" }, createMode: "Create", highAvailability: { mode: "SameZone" }, - location: "eastus", network: { delegatedSubnetResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", privateDnsZoneArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database", }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, - tags: { inCustomerVnet: "true", inMicrosoftVnet: "false" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new server. - * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReviveDropped.json - */ -async function createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "ReviveDropped", - location: "eastus", - pointInTimeUTC: new Date("2025-06-01T18:30:22.123456Z"), - sourceServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + tags: { InCustomerVnet: "true", InMicrosoftVnet: "false" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreatePointInTimeRestore.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreatePointInTimeRestore.json */ async function createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "PointInTimeRestore", + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { location: "eastus", + createMode: "PointInTimeRestore", pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), sourceServerResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateReplica.json */ -async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "GeoRestore", - dataEncryption: { - type: "AzureKeyVault", - geoBackupKeyURI: - "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", - geoBackupUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", - primaryUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", - }, +async function createAReadReplicaOfAnExistingServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { identity: { type: "UserAssigned", userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}, }, }, location: "eastus", - pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), - sourceServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new server. - * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabled.json - */ -async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "GeoRestore", + createMode: "Replica", dataEncryption: { type: "AzureKeyVault", - geoBackupKeyURI: - "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", - geoBackupUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + geoBackupKeyURI: "", + geoBackupUserAssignedIdentityId: "", primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), sourceServerResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateReviveDropped.json */ -async function createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - administratorLogin: "exampleadministratorlogin", - administratorLoginPassword: "examplepassword", - authConfig: { - activeDirectoryAuth: "Enabled", - passwordAuth: "Enabled", - tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", - }, - availabilityZone: "1", - backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" }, - createMode: "Create", - dataEncryption: { type: "SystemManaged" }, - highAvailability: { mode: "Disabled" }, - location: "eastus", - network: { - delegatedSubnetResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", - privateDnsZoneArmResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", - }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, - storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, - version: "17", - }; +async function createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", + createMode: "ReviveDropped", + pointInTimeUTC: new Date("2025-06-01T18:30:22.123456Z"), + sourceServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver", + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabledAutoUpdate.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateWithDataEncryptionEnabled.json */ -async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { +async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", @@ -379,56 +272,43 @@ async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAu geoBackupKeyURI: "", geoBackupUserAssignedIdentityId: "", primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, highAvailability: { mode: "ZoneRedundant" }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", network: { delegatedSubnetResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", privateDnsZoneArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabled.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateWithDataEncryptionEnabledAutoUpdate.json */ -async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { +async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", @@ -438,104 +318,73 @@ async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey(): Pr type: "AzureKeyVault", geoBackupKeyURI: "", geoBackupUserAssignedIdentityId: "", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, highAvailability: { mode: "ZoneRedundant" }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", network: { delegatedSubnetResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", privateDnsZoneArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReplica.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json */ -async function createAReadReplicaOfAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "Replica", - dataEncryption: { - type: "AzureKeyVault", - geoBackupKeyURI: "", - geoBackupUserAssignedIdentityId: "", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - primaryUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", +async function createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", + administratorLogin: "exampleadministratorlogin", + administratorLoginPassword: "examplepassword", + authConfig: { + activeDirectoryAuth: "Enabled", + passwordAuth: "Enabled", + tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, + availabilityZone: "1", + backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" }, + createMode: "Create", + dataEncryption: { type: "SystemManaged" }, + highAvailability: { mode: "Disabled" }, + network: { + delegatedSubnetResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", + privateDnsZoneArmResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, - location: "eastus", - pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), - sourceServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, + version: "17", + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); console.log(result); } async function main(): Promise { await createANewElasticCluster(); + await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); + await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); await createANewServerInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability(); await createANewServerInYourOwnVirtualNetworkWithSameZoneHighAvailability(); - await createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(); await createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer(); - await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); - await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); - await createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(); - await createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); - await createANewServerWithDataEncryptionBasedOnCustomerManagedKey(); await createAReadReplicaOfAnExistingServer(); + await createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(); + await createANewServerWithDataEncryptionBasedOnCustomerManagedKey(); + await createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); + await createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversDeleteSample.ts index cc497336f75b..97b62f027471 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversDeleteSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversDeleteSample.ts @@ -3,31 +3,18 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Deletes or drops an existing server. + * This sample demonstrates how to deletes or drops an existing server. * - * @summary Deletes or drops an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersDelete.json + * @summary deletes or drops an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersDelete.json */ async function deleteOrDropAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginDeleteAndWait( - resourceGroupName, - serverName, - ); - console.log(result); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.delete("exampleresourcegroup", "exampleserver"); } async function main(): Promise { diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversGetSample.ts index 00c12dd789c9..ae397b74818d 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversGetSample.ts @@ -3,78 +3,53 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets information about an existing server. + * This sample demonstrates how to gets information about an existing server. * - * @summary Gets information about an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithVnet.json + * @summary gets information about an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersGet.json */ -async function getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; +async function getInformationAboutAnExistingServer(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.get(resourceGroupName, serverName); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.get("exampleresourcegroup", "exampleserver"); console.log(result); } /** - * This sample demonstrates how to Gets information about an existing server. + * This sample demonstrates how to gets information about an existing server. * - * @summary Gets information about an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithPrivateEndpoints.json + * @summary gets information about an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersGetWithPrivateEndpoints.json */ async function getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.get(resourceGroupName, serverName); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.get("exampleresourcegroup", "exampleserver"); console.log(result); } /** - * This sample demonstrates how to Gets information about an existing server. + * This sample demonstrates how to gets information about an existing server. * - * @summary Gets information about an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGet.json + * @summary gets information about an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersGetWithVnet.json */ -async function getInformationAboutAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; +async function getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.get(resourceGroupName, serverName); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.get("exampleresourcegroup", "exampleserver"); console.log(result); } async function main(): Promise { - await getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(); - await getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections(); await getInformationAboutAnExistingServer(); + await getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections(); + await getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversListByResourceGroupSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversListByResourceGroupSample.ts index 44b95465d046..606bc73be489 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversListByResourceGroupSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversListByResourceGroupSample.ts @@ -3,31 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all servers in a resource group. + * This sample demonstrates how to lists all servers in a resource group. * - * @summary Lists all servers in a resource group. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListByResourceGroup.json + * @summary lists all servers in a resource group. + * x-ms-original-file: 2026-01-01-preview/ServersListByResourceGroup.json */ async function listAllServersInAResourceGroup(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.servers.listByResourceGroup( - resourceGroupName, - )) { + for await (const item of client.servers.listByResourceGroup("exampleresourcegroup")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversListBySubscriptionSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversListBySubscriptionSample.ts index 09682e1b35f7..8121b561380d 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversListBySubscriptionSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversListBySubscriptionSample.ts @@ -3,27 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all servers in a subscription. + * This sample demonstrates how to lists all servers in a subscription. * - * @summary Lists all servers in a subscription. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListBySubscription.json + * @summary lists all servers in a subscription. + * x-ms-original-file: 2026-01-01-preview/ServersListBySubscription.json */ async function listAllServersInASubscription(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.servers.listBySubscription()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversMigrateNetworkModeSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversMigrateNetworkModeSample.ts new file mode 100644 index 000000000000..f84bda8dea85 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversMigrateNetworkModeSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. + * + * @summary migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. + * x-ms-original-file: 2026-01-01-preview/ServersMigrateNetworkMode.json + */ +async function migrateServerNetworkConfiguration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.migrateNetworkMode("exampleresourcegroup", "exampleserver"); + console.log(result); +} + +async function main(): Promise { + await migrateServerNetworkConfiguration(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversRestartSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversRestartSample.ts index 0edcd6ffb798..76e07389867f 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversRestartSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversRestartSample.ts @@ -1,74 +1,40 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - RestartParameter, - ServersRestartOptionalParams} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Restarts PostgreSQL database engine in a server. + * This sample demonstrates how to restarts PostgreSQL database engine in a server. * - * @summary Restarts PostgreSQL database engine in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestartWithFailover.json + * @summary restarts PostgreSQL database engine in a server. + * x-ms-original-file: 2026-01-01-preview/ServersRestart.json */ -async function restartPostgreSqlDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: RestartParameter = { - failoverMode: "ForcedFailover", - restartWithFailover: true, - }; - const options: ServersRestartOptionalParams = { parameters }; +async function restartPostgreSQLDatabaseEngineInAServer(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginRestartAndWait( - resourceGroupName, - serverName, - options, - ); - console.log(result); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.restart("exampleresourcegroup", "exampleserver"); } /** - * This sample demonstrates how to Restarts PostgreSQL database engine in a server. + * This sample demonstrates how to restarts PostgreSQL database engine in a server. * - * @summary Restarts PostgreSQL database engine in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestart.json + * @summary restarts PostgreSQL database engine in a server. + * x-ms-original-file: 2026-01-01-preview/ServersRestartWithFailover.json */ -async function restartPostgreSqlDatabaseEngineInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; +async function restartPostgreSQLDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginRestartAndWait( - resourceGroupName, - serverName, - ); - console.log(result); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.restart("exampleresourcegroup", "exampleserver", { + parameters: { failoverMode: "ForcedFailover", restartWithFailover: true }, + }); } async function main(): Promise { - await restartPostgreSqlDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(); - await restartPostgreSqlDatabaseEngineInAServer(); + await restartPostgreSQLDatabaseEngineInAServer(); + await restartPostgreSQLDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversStartSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversStartSample.ts index 9ad3ec397615..3768a06f40cd 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversStartSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversStartSample.ts @@ -3,31 +3,18 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Starts a stopped server. + * This sample demonstrates how to starts a stopped server. * - * @summary Starts a stopped server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStart.json + * @summary starts a stopped server. + * x-ms-original-file: 2026-01-01-preview/ServersStart.json */ async function startAStoppedServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginStartAndWait( - resourceGroupName, - serverName, - ); - console.log(result); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.start("exampleresourcegroup", "exampleserver"); } async function main(): Promise { diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversStopSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversStopSample.ts index 9ed4eb2ce206..09b4550b702f 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversStopSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversStopSample.ts @@ -3,31 +3,18 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Stops a server. + * This sample demonstrates how to stops a server. * - * @summary Stops a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStop.json + * @summary stops a server. + * x-ms-original-file: 2026-01-01-preview/ServersStop.json */ async function stopAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginStopAndWait( - resourceGroupName, - serverName, - ); - console.log(result); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.stop("exampleresourcegroup", "exampleserver"); } async function main(): Promise { diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversUpdateSample.ts index d58545d0a9c8..1e1079f998e3 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/serversUpdateSample.ts @@ -1,378 +1,239 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - ServerForPatch} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsForcedStandaloneServer.json */ async function promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - replica: { promoteMode: "Standalone", promoteOption: "Forced" }, - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Standalone", promoteOption: "Forced" }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedStandaloneServer.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsForcedSwitchover.json */ -async function promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - replica: { promoteMode: "Standalone", promoteOption: "Planned" }, - }; +async function switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Switchover", promoteOption: "Forced" }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedSwitchover.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsPlannedStandaloneServer.json */ -async function switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - replica: { promoteMode: "Switchover", promoteOption: "Forced" }, - }; +async function promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Standalone", promoteOption: "Planned" }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedSwitchover.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsPlannedSwitchover.json */ async function switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - replica: { promoteMode: "Switchover", promoteOption: "Planned" }, - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Switchover", promoteOption: "Planned" }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMajorVersionUpgrade.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdate.json */ -async function updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSqlDatabaseEngine(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { createMode: "Update", version: "17" }; +async function updateAnExistingServer(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMicrosoftEntraEnabled.json - */ -async function updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { administratorLoginPassword: "examplenewpassword", - authConfig: { - activeDirectoryAuth: "Enabled", - passwordAuth: "Enabled", - tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", - }, backup: { backupRetentionDays: 20 }, createMode: "Update", + storage: { autoGrow: "Enabled", storageSizeGB: 1024, tier: "P30" }, sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - storage: { autoGrow: "Disabled", storageSizeGB: 1024, tier: "P30" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithCustomMaintenanceWindow.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithCustomMaintenanceWindow.json */ async function updateAnExistingServerWithCustomMaintenanceWindow(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - createMode: "Update", - maintenanceWindow: { - customWindow: "Enabled", - dayOfWeek: 0, - startHour: 8, - startMinute: 0, - }, - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + createMode: "Update", + maintenanceWindow: { customWindow: "Enabled", dayOfWeek: 0, startHour: 8, startMinute: 0 }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithDataEncryptionEnabled.json */ -async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { +async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, administratorLoginPassword: "examplenewpassword", backup: { backupRetentionDays: 20 }, createMode: "Update", dataEncryption: { type: "AzureKeyVault", geoBackupKeyURI: - "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", + "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", geoBackupUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabled.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json */ -async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { +async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, administratorLoginPassword: "examplenewpassword", backup: { backupRetentionDays: 20 }, createMode: "Update", dataEncryption: { type: "AzureKeyVault", - geoBackupKeyURI: - "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", + geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", geoBackupUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - }; + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithMajorVersionUpgrade.json + */ +async function updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSQLDatabaseEngine(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + createMode: "Update", + version: "17", + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithMicrosoftEntraEnabled.json */ -async function updateAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { +async function updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { administratorLoginPassword: "examplenewpassword", + authConfig: { + activeDirectoryAuth: "Enabled", + passwordAuth: "Enabled", + tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", + }, backup: { backupRetentionDays: 20 }, createMode: "Update", + storage: { autoGrow: "Disabled", storageSizeGB: 1024, tier: "P30" }, sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - storage: { autoGrow: "Enabled", storageSizeGB: 1024, tier: "P30" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + }); console.log(result); } async function main(): Promise { await promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); - await promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); await switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(); + await promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); await switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(); - await updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSqlDatabaseEngine(); - await updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(); + await updateAnExistingServer(); await updateAnExistingServerWithCustomMaintenanceWindow(); - await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); - await updateAnExistingServer(); + await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); + await updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSQLDatabaseEngine(); + await updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsGetSample.ts index 52d81c4d1449..63b61f9d8e2f 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsGetSample.ts @@ -3,32 +3,18 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the tuning options of a server. + * This sample demonstrates how to gets the tuning options of a server. * - * @summary Gets the tuning options of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsGet.json + * @summary gets the tuning options of a server. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsGet.json */ async function getTheTuningOptionsOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "index"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.tuningOptionsOperations.get( - resourceGroupName, - serverName, - tuningOption, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.tuningOptions.get("exampleresourcegroup", "exampleserver", "index"); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsListByServerSample.ts index 24685d90c4e9..161ed480236e 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the tuning options of a server. + * This sample demonstrates how to lists the tuning options of a server. * - * @summary Lists the tuning options of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListByServer.json + * @summary lists the tuning options of a server. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListByServer.json */ async function listTheTuningOptionsOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listByServer( - resourceGroupName, - serverName, + for await (const item of client.tuningOptions.listByServer( + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsListRecommendationsSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsListRecommendationsSample.ts index a3be87c8a681..53c7dd659a7f 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsListRecommendationsSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/tuningOptionsListRecommendationsSample.ts @@ -1,149 +1,104 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - TuningOptionsListRecommendationsOptionalParams} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists available object recommendations. + * This sample demonstrates how to lists available object recommendations. * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListIndexRecommendations.json */ -async function listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "index"; - const recommendationType = "CreateIndex"; - const options: TuningOptionsListRecommendationsOptionalParams = { - recommendationType, - }; +async function listAvailableIndexRecommendations(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - options, + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "index", )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists available object recommendations. + * This sample demonstrates how to lists available object recommendations. * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendations.json + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json */ -async function listAvailableIndexRecommendations(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "index"; +async function listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "index", + { recommendationType: "CreateIndex" }, )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists available object recommendations. + * This sample demonstrates how to lists available object recommendations. * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListTableRecommendations.json */ -async function listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "table"; - const recommendationType = "AnalyzeTable"; - const options: TuningOptionsListRecommendationsOptionalParams = { - recommendationType, - }; +async function listAvailableTableRecommendations(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - options, + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "table", )) { resArray.push(item); } + console.log(resArray); } /** - * This sample demonstrates how to Lists available object recommendations. + * This sample demonstrates how to lists available object recommendations. * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendations.json + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json */ -async function listAvailableTableRecommendations(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "table"; +async function listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "table", + { recommendationType: "AnalyzeTable" }, )) { resArray.push(item); } + console.log(resArray); } async function main(): Promise { - await listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(); await listAvailableIndexRecommendations(); - await listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(); + await listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(); await listAvailableTableRecommendations(); + await listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsCreateSample.ts index 7a55d067dfae..7929e2cb3789 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsCreateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsCreateSample.ts @@ -1,42 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - VirtualEndpoint} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates a pair of virtual endpoints for a server. + * This sample demonstrates how to creates a pair of virtual endpoints for a server. * - * @summary Creates a pair of virtual endpoints for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointCreate.json + * @summary creates a pair of virtual endpoints for a server. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointCreate.json */ async function createAPairOfVirtualEndpointsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; - const parameters: VirtualEndpoint = { - endpointType: "ReadWrite", - members: ["exampleprimaryserver"], - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.virtualEndpoints.beginCreateAndWait( - resourceGroupName, - serverName, - virtualEndpointName, - parameters, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.virtualEndpoints.create( + "exampleresourcegroup", + "exampleserver", + "examplebasename", + { endpointType: "ReadWrite", members: ["exampleprimaryserver"] }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsDeleteSample.ts index 3e05399f9736..acaabcbd4920 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsDeleteSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsDeleteSample.ts @@ -3,33 +3,18 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Deletes a pair of virtual endpoints. + * This sample demonstrates how to deletes a pair of virtual endpoints. * - * @summary Deletes a pair of virtual endpoints. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointDelete.json + * @summary deletes a pair of virtual endpoints. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointDelete.json */ async function deleteAPairOfVirtualEndpoints(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.virtualEndpoints.beginDeleteAndWait( - resourceGroupName, - serverName, - virtualEndpointName, - ); - console.log(result); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.virtualEndpoints.delete("exampleresourcegroup", "exampleserver", "examplebasename"); } async function main(): Promise { diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsGetSample.ts index 1c027f52f526..9038df718647 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsGetSample.ts @@ -3,31 +3,21 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets information about a pair of virtual endpoints. + * This sample demonstrates how to gets information about a pair of virtual endpoints. * - * @summary Gets information about a pair of virtual endpoints. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsGet.json + * @summary gets information about a pair of virtual endpoints. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointsGet.json */ async function getInformationAboutAPairOfVirtualEndpoints(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.virtualEndpoints.get( - resourceGroupName, - serverName, - virtualEndpointName, + "exampleresourcegroup", + "exampleserver", + "examplebasename", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsListByServerSample.ts index 540561e18473..65d719b51f3e 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists pair of virtual endpoints associated to a server. + * This sample demonstrates how to lists pair of virtual endpoints associated to a server. * - * @summary Lists pair of virtual endpoints associated to a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsListByServer.json + * @summary lists pair of virtual endpoints associated to a server. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointsListByServer.json */ async function listPairOfVirtualEndpointsAssociatedToAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.virtualEndpoints.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsUpdateSample.ts index 3c854fd9cf81..a44848a0575b 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualEndpointsUpdateSample.ts @@ -1,42 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - VirtualEndpointResourceForPatch} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Updates a pair of virtual endpoints for a server. + * This sample demonstrates how to updates a pair of virtual endpoints for a server. * - * @summary Updates a pair of virtual endpoints for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointUpdate.json + * @summary updates a pair of virtual endpoints for a server. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointUpdate.json */ async function updateAPairOfVirtualEndpointsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; - const parameters: VirtualEndpointResourceForPatch = { - endpointType: "ReadWrite", - members: ["exampleprimaryserver"], - }; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.virtualEndpoints.beginUpdateAndWait( - resourceGroupName, - serverName, - virtualEndpointName, - parameters, + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.virtualEndpoints.update( + "exampleresourcegroup", + "exampleserver", + "examplebasename", + { endpointType: "ReadWrite", members: ["exampleprimaryserver"] }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualNetworkSubnetUsageListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualNetworkSubnetUsageListSample.ts index 2d1b0b296568..3ceef8c6a6fb 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualNetworkSubnetUsageListSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples-dev/virtualNetworkSubnetUsageListSample.ts @@ -1,38 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - VirtualNetworkSubnetUsageParameter} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the virtual network subnet usage for a given virtual network. + * This sample demonstrates how to lists the virtual network subnet usage for a given virtual network. * - * @summary Lists the virtual network subnet usage for a given virtual network. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualNetworkSubnetUsageList.json + * @summary lists the virtual network subnet usage for a given virtual network. + * x-ms-original-file: 2026-01-01-preview/VirtualNetworkSubnetUsageList.json */ async function listTheVirtualNetworkSubnetUsageForAGivenVirtualNetwork(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; - const parameters: VirtualNetworkSubnetUsageParameter = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.virtualNetworkSubnetUsage.list("eastus", { virtualNetworkArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.virtualNetworkSubnetUsage.list( - locationName, - parameters, - ); + }); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/README.md b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/README.md new file mode 100644 index 000000000000..31084c719f2b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/README.md @@ -0,0 +1,182 @@ +# @azure/arm-postgresql-flexible client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for @azure/arm-postgresql-flexible in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [administratorsMicrosoftEntraCreateOrUpdateSample.js][administratorsmicrosoftentracreateorupdatesample] | creates a new server administrator associated to a Microsoft Entra principal. x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraAdd.json | +| [administratorsMicrosoftEntraDeleteSample.js][administratorsmicrosoftentradeletesample] | deletes an existing server administrator associated to a Microsoft Entra principal. x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraDelete.json | +| [administratorsMicrosoftEntraGetSample.js][administratorsmicrosoftentragetsample] | gets information about a server administrator associated to a Microsoft Entra principal. x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraGet.json | +| [administratorsMicrosoftEntraListByServerSample.js][administratorsmicrosoftentralistbyserversample] | list all server administrators associated to a Microsoft Entra principal. x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraListByServer.json | +| [advancedThreatProtectionSettingsGetSample.js][advancedthreatprotectionsettingsgetsample] | gets state of advanced threat protection settings for a server. x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsGet.json | +| [advancedThreatProtectionSettingsListByServerSample.js][advancedthreatprotectionsettingslistbyserversample] | lists state of advanced threat protection settings for a server. x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsListByServer.json | +| [backupsAutomaticAndOnDemandCreateSample.js][backupsautomaticandondemandcreatesample] | creates an on demand backup of a server. x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandCreate.json | +| [backupsAutomaticAndOnDemandDeleteSample.js][backupsautomaticandondemanddeletesample] | deletes a specific backup, given its name. x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandDelete.json | +| [backupsAutomaticAndOnDemandGetSample.js][backupsautomaticandondemandgetsample] | gets information of an on demand backup, given its name. x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandGet.json | +| [backupsAutomaticAndOnDemandListByServerSample.js][backupsautomaticandondemandlistbyserversample] | lists all available backups of a server. x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandListByServer.json | +| [backupsLongTermRetentionCheckPrerequisitesSample.js][backupslongtermretentioncheckprerequisitessample] | performs all checks required for a long term retention backup operation to succeed. x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionCheckPrerequisites.json | +| [backupsLongTermRetentionGetSample.js][backupslongtermretentiongetsample] | gets the results of a long retention backup operation for a server. x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionGet.json | +| [backupsLongTermRetentionListByServerSample.js][backupslongtermretentionlistbyserversample] | lists the results of the long term retention backup operations for a server. x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionListByServer.json | +| [backupsLongTermRetentionStartSample.js][backupslongtermretentionstartsample] | initiates a long term retention backup. x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionStart.json | +| [capabilitiesByLocationListSample.js][capabilitiesbylocationlistsample] | lists the capabilities available in a given location for a specific subscription. x-ms-original-file: 2026-01-01-preview/CapabilitiesByLocationList.json | +| [capabilitiesByServerListSample.js][capabilitiesbyserverlistsample] | lists the capabilities available for a given server. x-ms-original-file: 2026-01-01-preview/CapabilitiesByServerList.json | +| [capturedLogsListByServerSample.js][capturedlogslistbyserversample] | lists all captured logs for download in a server. x-ms-original-file: 2026-01-01-preview/CapturedLogsListByServer.json | +| [configurationsGetSample.js][configurationsgetsample] | gets information about a specific configuration (also known as server parameter) of a server. x-ms-original-file: 2026-01-01-preview/ConfigurationsGet.json | +| [configurationsListByServerSample.js][configurationslistbyserversample] | lists all configurations (also known as server parameters) of a server. x-ms-original-file: 2026-01-01-preview/ConfigurationsListByServer.json | +| [configurationsPutSample.js][configurationsputsample] | updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdateUsingPut.json | +| [configurationsUpdateSample.js][configurationsupdatesample] | updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdate.json | +| [databasesCreateSample.js][databasescreatesample] | creates a new database. x-ms-original-file: 2026-01-01-preview/DatabasesCreate.json | +| [databasesDeleteSample.js][databasesdeletesample] | deletes an existing database. x-ms-original-file: 2026-01-01-preview/DatabasesDelete.json | +| [databasesGetSample.js][databasesgetsample] | gets information about an existing database. x-ms-original-file: 2026-01-01-preview/DatabasesGet.json | +| [databasesListByServerSample.js][databaseslistbyserversample] | lists all databases in a server. x-ms-original-file: 2026-01-01-preview/DatabasesListByServer.json | +| [firewallRulesCreateOrUpdateSample.js][firewallrulescreateorupdatesample] | creates a new firewall rule or updates an existing firewall rule. x-ms-original-file: 2026-01-01-preview/FirewallRulesCreateOrUpdate.json | +| [firewallRulesDeleteSample.js][firewallrulesdeletesample] | deletes an existing firewall rule. x-ms-original-file: 2026-01-01-preview/FirewallRulesDelete.json | +| [firewallRulesGetSample.js][firewallrulesgetsample] | gets information about a firewall rule in a server. x-ms-original-file: 2026-01-01-preview/FirewallRulesGet.json | +| [firewallRulesListByServerSample.js][firewallruleslistbyserversample] | lists information about all firewall rules in a server. x-ms-original-file: 2026-01-01-preview/FirewallRulesListByServer.json | +| [migrationsCancelSample.js][migrationscancelsample] | cancels an active migration. x-ms-original-file: 2026-01-01-preview/MigrationsCancel.json | +| [migrationsCheckNameAvailabilitySample.js][migrationschecknameavailabilitysample] | checks if a proposed migration name is valid and available. x-ms-original-file: 2026-01-01-preview/MigrationsCheckNameAvailability.json | +| [migrationsCreateSample.js][migrationscreatesample] | creates a new migration. x-ms-original-file: 2026-01-01-preview/MigrationsCreate.json | +| [migrationsGetSample.js][migrationsgetsample] | gets information about a migration. x-ms-original-file: 2026-01-01-preview/MigrationsGet.json | +| [migrationsListByTargetServerSample.js][migrationslistbytargetserversample] | lists all migrations of a target flexible server. x-ms-original-file: 2026-01-01-preview/MigrationsListByTargetServer.json | +| [migrationsUpdateSample.js][migrationsupdatesample] | updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. x-ms-original-file: 2026-01-01-preview/MigrationsUpdate.json | +| [nameAvailabilityCheckGloballySample.js][nameavailabilitycheckgloballysample] | checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckGlobally.json | +| [nameAvailabilityCheckWithLocationSample.js][nameavailabilitycheckwithlocationsample] | check the availability of name for resource x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckWithLocation.json | +| [operationsListSample.js][operationslistsample] | lists all available REST API operations. x-ms-original-file: 2026-01-01-preview/OperationsList.json | +| [privateDnsZoneSuffixGetSample.js][privatednszonesuffixgetsample] | gets the private DNS zone suffix. x-ms-original-file: 2026-01-01-preview/PrivateDnsZoneSuffixGet.json | +| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | deletes a private endpoint connection. x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsDelete.json | +| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | gets a private endpoint connection. x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsGet.json | +| [privateEndpointConnectionsListByServerSample.js][privateendpointconnectionslistbyserversample] | lists all private endpoint connections on a server. x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsList.json | +| [privateEndpointConnectionsUpdateSample.js][privateendpointconnectionsupdatesample] | approves or rejects a private endpoint connection. x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsUpdate.json | +| [privateLinkResourcesGetSample.js][privatelinkresourcesgetsample] | gets a private link resource for PostgreSQL server. x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesGet.json | +| [privateLinkResourcesListByServerSample.js][privatelinkresourceslistbyserversample] | gets the private link resources for PostgreSQL server. x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesList.json | +| [quotaUsagesListSample.js][quotausageslistsample] | get quota usages at specified location in a given subscription. x-ms-original-file: 2026-01-01-preview/QuotaUsagesForFlexibleServers.json | +| [replicasListByServerSample.js][replicaslistbyserversample] | lists all read replicas of a server. x-ms-original-file: 2026-01-01-preview/ReplicasListByServer.json | +| [serverThreatProtectionSettingsCreateOrUpdateSample.js][serverthreatprotectionsettingscreateorupdatesample] | creates or updates a server's Advanced Threat Protection settings. x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsCreateOrUpdate.json | +| [serversCreateOrUpdateSample.js][serverscreateorupdatesample] | creates a new server. x-ms-original-file: 2026-01-01-preview/ServersClusterCreate.json | +| [serversDeleteSample.js][serversdeletesample] | deletes or drops an existing server. x-ms-original-file: 2026-01-01-preview/ServersDelete.json | +| [serversGetSample.js][serversgetsample] | gets information about an existing server. x-ms-original-file: 2026-01-01-preview/ServersGet.json | +| [serversListByResourceGroupSample.js][serverslistbyresourcegroupsample] | lists all servers in a resource group. x-ms-original-file: 2026-01-01-preview/ServersListByResourceGroup.json | +| [serversListBySubscriptionSample.js][serverslistbysubscriptionsample] | lists all servers in a subscription. x-ms-original-file: 2026-01-01-preview/ServersListBySubscription.json | +| [serversMigrateNetworkModeSample.js][serversmigratenetworkmodesample] | migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. x-ms-original-file: 2026-01-01-preview/ServersMigrateNetworkMode.json | +| [serversRestartSample.js][serversrestartsample] | restarts PostgreSQL database engine in a server. x-ms-original-file: 2026-01-01-preview/ServersRestart.json | +| [serversStartSample.js][serversstartsample] | starts a stopped server. x-ms-original-file: 2026-01-01-preview/ServersStart.json | +| [serversStopSample.js][serversstopsample] | stops a server. x-ms-original-file: 2026-01-01-preview/ServersStop.json | +| [serversUpdateSample.js][serversupdatesample] | updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsForcedStandaloneServer.json | +| [tuningOptionsGetSample.js][tuningoptionsgetsample] | gets the tuning options of a server. x-ms-original-file: 2026-01-01-preview/TuningOptionsGet.json | +| [tuningOptionsListByServerSample.js][tuningoptionslistbyserversample] | lists the tuning options of a server. x-ms-original-file: 2026-01-01-preview/TuningOptionsListByServer.json | +| [tuningOptionsListRecommendationsSample.js][tuningoptionslistrecommendationssample] | lists available object recommendations. x-ms-original-file: 2026-01-01-preview/TuningOptionsListIndexRecommendations.json | +| [virtualEndpointsCreateSample.js][virtualendpointscreatesample] | creates a pair of virtual endpoints for a server. x-ms-original-file: 2026-01-01-preview/VirtualEndpointCreate.json | +| [virtualEndpointsDeleteSample.js][virtualendpointsdeletesample] | deletes a pair of virtual endpoints. x-ms-original-file: 2026-01-01-preview/VirtualEndpointDelete.json | +| [virtualEndpointsGetSample.js][virtualendpointsgetsample] | gets information about a pair of virtual endpoints. x-ms-original-file: 2026-01-01-preview/VirtualEndpointsGet.json | +| [virtualEndpointsListByServerSample.js][virtualendpointslistbyserversample] | lists pair of virtual endpoints associated to a server. x-ms-original-file: 2026-01-01-preview/VirtualEndpointsListByServer.json | +| [virtualEndpointsUpdateSample.js][virtualendpointsupdatesample] | updates a pair of virtual endpoints for a server. x-ms-original-file: 2026-01-01-preview/VirtualEndpointUpdate.json | +| [virtualNetworkSubnetUsageListSample.js][virtualnetworksubnetusagelistsample] | lists the virtual network subnet usage for a given virtual network. x-ms-original-file: 2026-01-01-preview/VirtualNetworkSubnetUsageList.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 administratorsMicrosoftEntraCreateOrUpdateSample.js +``` + +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +node administratorsMicrosoftEntraCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[administratorsmicrosoftentracreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraCreateOrUpdateSample.js +[administratorsmicrosoftentradeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraDeleteSample.js +[administratorsmicrosoftentragetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraGetSample.js +[administratorsmicrosoftentralistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraListByServerSample.js +[advancedthreatprotectionsettingsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/advancedThreatProtectionSettingsGetSample.js +[advancedthreatprotectionsettingslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/advancedThreatProtectionSettingsListByServerSample.js +[backupsautomaticandondemandcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandCreateSample.js +[backupsautomaticandondemanddeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandDeleteSample.js +[backupsautomaticandondemandgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandGetSample.js +[backupsautomaticandondemandlistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandListByServerSample.js +[backupslongtermretentioncheckprerequisitessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionCheckPrerequisitesSample.js +[backupslongtermretentiongetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionGetSample.js +[backupslongtermretentionlistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionListByServerSample.js +[backupslongtermretentionstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionStartSample.js +[capabilitiesbylocationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capabilitiesByLocationListSample.js +[capabilitiesbyserverlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capabilitiesByServerListSample.js +[capturedlogslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capturedLogsListByServerSample.js +[configurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsGetSample.js +[configurationslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsListByServerSample.js +[configurationsputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsPutSample.js +[configurationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsUpdateSample.js +[databasescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesCreateSample.js +[databasesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesDeleteSample.js +[databasesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesGetSample.js +[databaseslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesListByServerSample.js +[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesCreateOrUpdateSample.js +[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesDeleteSample.js +[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesGetSample.js +[firewallruleslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesListByServerSample.js +[migrationscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCancelSample.js +[migrationschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCheckNameAvailabilitySample.js +[migrationscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCreateSample.js +[migrationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsGetSample.js +[migrationslistbytargetserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsListByTargetServerSample.js +[migrationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsUpdateSample.js +[nameavailabilitycheckgloballysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/nameAvailabilityCheckGloballySample.js +[nameavailabilitycheckwithlocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/nameAvailabilityCheckWithLocationSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/operationsListSample.js +[privatednszonesuffixgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateDnsZoneSuffixGetSample.js +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsDeleteSample.js +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsGetSample.js +[privateendpointconnectionslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsListByServerSample.js +[privateendpointconnectionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsUpdateSample.js +[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateLinkResourcesGetSample.js +[privatelinkresourceslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateLinkResourcesListByServerSample.js +[quotausageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/quotaUsagesListSample.js +[replicaslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/replicasListByServerSample.js +[serverthreatprotectionsettingscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serverThreatProtectionSettingsCreateOrUpdateSample.js +[serverscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversCreateOrUpdateSample.js +[serversdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversDeleteSample.js +[serversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversGetSample.js +[serverslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversListByResourceGroupSample.js +[serverslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversListBySubscriptionSample.js +[serversmigratenetworkmodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversMigrateNetworkModeSample.js +[serversrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversRestartSample.js +[serversstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversStartSample.js +[serversstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversStopSample.js +[serversupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversUpdateSample.js +[tuningoptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsGetSample.js +[tuningoptionslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsListByServerSample.js +[tuningoptionslistrecommendationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsListRecommendationsSample.js +[virtualendpointscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsCreateSample.js +[virtualendpointsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsDeleteSample.js +[virtualendpointsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsGetSample.js +[virtualendpointslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsListByServerSample.js +[virtualendpointsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsUpdateSample.js +[virtualnetworksubnetusagelistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualNetworkSubnetUsageListSample.js +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-postgresql-flexible?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible/README.md diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraCreateOrUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraCreateOrUpdateSample.js new file mode 100644 index 000000000000..a96545695b70 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraCreateOrUpdateSample.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates a new server administrator associated to a Microsoft Entra principal. + * + * @summary creates a new server administrator associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraAdd.json + */ +async function addAServerAdministratorAssociatedToAMicrosoftEntraPrincipal() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.administratorsMicrosoftEntra.createOrUpdate( + "exampleresourcegroup", + "exampleserver", + "oooooooo-oooo-oooo-oooo-oooooooooooo", + { + principalName: "exampleuser@contoso.com", + principalType: "User", + tenantId: "tttttttt-tttt-tttt-tttt-tttttttttttt", + }, + ); + console.log(result); +} + +async function main() { + await addAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraDeleteSample.js new file mode 100644 index 000000000000..53bacb05d8b9 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraDeleteSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes an existing server administrator associated to a Microsoft Entra principal. + * + * @summary deletes an existing server administrator associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraDelete.json + */ +async function deleteAServerAdministratorAssociatedToAMicrosoftEntraPrincipal() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.administratorsMicrosoftEntra.delete( + "exampleresourcegroup", + "exampleserver", + "oooooooo-oooo-oooo-oooo-oooooooooooo", + ); +} + +async function main() { + await deleteAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraGetSample.js similarity index 55% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraGetSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraGetSample.js index 890ca9a875d4..d68e38954ef2 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraGetSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraGetSample.js @@ -3,26 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Gets information about a server administrator associated to a Microsoft Entra principal. + * This sample demonstrates how to gets information about a server administrator associated to a Microsoft Entra principal. * - * @summary Gets information about a server administrator associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraGet.json + * @summary gets information about a server administrator associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraGet.json */ async function getInformationAboutAServerAdministratorAssociatedToAMicrosoftEntraPrincipal() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.administratorsMicrosoftEntra.get( - resourceGroupName, - serverName, - objectId, + "exampleresourcegroup", + "exampleserver", + "oooooooo-oooo-oooo-oooo-oooooooooooo", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraListByServerSample.js similarity index 59% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraListByServerSample.js index de3a07cb77a5..9aacdc2faafc 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/administratorsMicrosoftEntraListByServerSample.js @@ -3,28 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to List all server administrators associated to a Microsoft Entra principal. + * This sample demonstrates how to list all server administrators associated to a Microsoft Entra principal. * - * @summary List all server administrators associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraListByServer.json + * @summary list all server administrators associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraListByServer.json */ async function listInformationAboutAllServerAdministratorsAssociatedToMicrosoftEntraPrincipals() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.administratorsMicrosoftEntra.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/advancedThreatProtectionSettingsGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/advancedThreatProtectionSettingsGetSample.js similarity index 52% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/advancedThreatProtectionSettingsGetSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/advancedThreatProtectionSettingsGetSample.js index 41e5ef82ec9b..a9112b1517ed 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/advancedThreatProtectionSettingsGetSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/advancedThreatProtectionSettingsGetSample.js @@ -3,26 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Gets state of advanced threat protection settings for a server. + * This sample demonstrates how to gets state of advanced threat protection settings for a server. * - * @summary Gets state of advanced threat protection settings for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsGet.json + * @summary gets state of advanced threat protection settings for a server. + * x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsGet.json */ async function getStateOfAdvancedThreatProtectionSettingsForAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const threatProtectionName = "Default"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.advancedThreatProtectionSettings.get( - resourceGroupName, - serverName, - threatProtectionName, + "exampleresourcegroup", + "exampleserver", + "Default", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/advancedThreatProtectionSettingsListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/advancedThreatProtectionSettingsListByServerSample.js similarity index 57% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/advancedThreatProtectionSettingsListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/advancedThreatProtectionSettingsListByServerSample.js index e360623e2915..8af80d4068b7 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/advancedThreatProtectionSettingsListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/advancedThreatProtectionSettingsListByServerSample.js @@ -3,28 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists state of advanced threat protection settings for a server. + * This sample demonstrates how to lists state of advanced threat protection settings for a server. * - * @summary Lists state of advanced threat protection settings for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsListByServer.json + * @summary lists state of advanced threat protection settings for a server. + * x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsListByServer.json */ async function listStateOfAdvancedThreatProtectionSettingsForAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.advancedThreatProtectionSettings.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandCreateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandCreateSample.js new file mode 100644 index 000000000000..5844a552871e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandCreateSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates an on demand backup of a server. + * + * @summary creates an on demand backup of a server. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandCreate.json + */ +async function createAnOnDemandBackupOfAServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.backupsAutomaticAndOnDemand.create( + "exampleresourcegroup", + "exampleserver", + "ondemandbackup-20250601T183022", + ); + console.log(result); +} + +async function main() { + await createAnOnDemandBackupOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandDeleteSample.js new file mode 100644 index 000000000000..e4e06ce0862f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandDeleteSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes a specific backup, given its name. + * + * @summary deletes a specific backup, given its name. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandDelete.json + */ +async function deleteAnOnDemandBackupGivenItsName() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.backupsAutomaticAndOnDemand.delete( + "exampleresourcegroup", + "exampleserver", + "ondemandbackup-20250601T183022", + ); +} + +async function main() { + await deleteAnOnDemandBackupGivenItsName(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandGetSample.js similarity index 50% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandGetSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandGetSample.js index 949e0be98dda..ccac1f10f3e4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandGetSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandGetSample.js @@ -3,26 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Gets information of an on demand backup, given its name. + * This sample demonstrates how to gets information of an on demand backup, given its name. * - * @summary Gets information of an on demand backup, given its name. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandGet.json + * @summary gets information of an on demand backup, given its name. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandGet.json */ async function getAnOnDemandBackupGivenItsName() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "backup_638830782181266873"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.backupsAutomaticAndOnDemand.get( - resourceGroupName, - serverName, - backupName, + "exampleresourcegroup", + "exampleserver", + "backup_638830782181266873", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandListByServerSample.js similarity index 55% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandListByServerSample.js index 2a006a4a8c96..00095cacc9b3 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsAutomaticAndOnDemandListByServerSample.js @@ -3,28 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all available backups of a server. + * This sample demonstrates how to lists all available backups of a server. * - * @summary Lists all available backups of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandListByServer.json + * @summary lists all available backups of a server. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandListByServer.json */ async function listAllAvailableBackupsOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.backupsAutomaticAndOnDemand.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionCheckPrerequisitesSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionCheckPrerequisitesSample.js similarity index 53% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionCheckPrerequisitesSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionCheckPrerequisitesSample.js index 6eba302a403b..c6ab3da7a173 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionCheckPrerequisitesSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionCheckPrerequisitesSample.js @@ -3,28 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Performs all checks required for a long term retention backup operation to succeed. + * This sample demonstrates how to performs all checks required for a long term retention backup operation to succeed. * - * @summary Performs all checks required for a long term retention backup operation to succeed. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionCheckPrerequisites.json + * @summary performs all checks required for a long term retention backup operation to succeed. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionCheckPrerequisites.json */ async function performAllChecksRequiredForALongTermRetentionBackupOperationToSucceed() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - backupSettings: { backupName: "exampleltrbackup" }, - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.backupsLongTermRetention.checkPrerequisites( - resourceGroupName, - serverName, - parameters, + "exampleresourcegroup", + "exampleserver", + { backupSettings: { backupName: "exampleltrbackup" } }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionGetSample.js similarity index 52% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionGetSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionGetSample.js index f66401588815..7975189cb984 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionGetSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionGetSample.js @@ -3,26 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Gets the results of a long retention backup operation for a server. + * This sample demonstrates how to gets the results of a long retention backup operation for a server. * - * @summary Gets the results of a long retention backup operation for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionGet.json + * @summary gets the results of a long retention backup operation for a server. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionGet.json */ async function getTheResultsOfALongRetentionBackupOperationForAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "exampleltrbackup"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.backupsLongTermRetention.get( - resourceGroupName, - serverName, - backupName, + "exampleresourcegroup", + "exampleserver", + "exampleltrbackup", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionListByServerSample.js similarity index 58% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionListByServerSample.js index f8906a294c41..47594609e67f 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionListByServerSample.js @@ -3,28 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists the results of the long term retention backup operations for a server. + * This sample demonstrates how to lists the results of the long term retention backup operations for a server. * - * @summary Lists the results of the long term retention backup operations for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionListByServer.json + * @summary lists the results of the long term retention backup operations for a server. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionListByServer.json */ async function listTheResultsOfTheLongTermRetentionBackupOperationsForAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.backupsLongTermRetention.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionStartSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionStartSample.js new file mode 100644 index 000000000000..7b2675d6c316 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/backupsLongTermRetentionStartSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to initiates a long term retention backup. + * + * @summary initiates a long term retention backup. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionStart.json + */ +async function initiateALongTermRetentionBackup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.backupsLongTermRetention.start( + "exampleresourcegroup", + "exampleserver", + { + backupSettings: { backupName: "exampleltrbackup" }, + targetDetails: { sasUriList: ["sasuri"] }, + }, + ); + console.log(result); +} + +async function main() { + await initiateALongTermRetentionBackup(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capabilitiesByLocationListSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capabilitiesByLocationListSample.js similarity index 59% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capabilitiesByLocationListSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capabilitiesByLocationListSample.js index ee5cff9ce8c8..92c7a0871203 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capabilitiesByLocationListSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capabilitiesByLocationListSample.js @@ -3,24 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists the capabilities available in a given location for a specific subscription. + * This sample demonstrates how to lists the capabilities available in a given location for a specific subscription. * - * @summary Lists the capabilities available in a given location for a specific subscription. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByLocationList.json + * @summary lists the capabilities available in a given location for a specific subscription. + * x-ms-original-file: 2026-01-01-preview/CapabilitiesByLocationList.json */ async function listTheCapabilitiesAvailableInAGivenLocationForASpecificSubscription() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.capabilitiesByLocation.list(locationName)) { + for await (const item of client.capabilitiesByLocation.list("eastus")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capabilitiesByServerListSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capabilitiesByServerListSample.js similarity index 51% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capabilitiesByServerListSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capabilitiesByServerListSample.js index 07f5e6a71b83..66d80edc2bb4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capabilitiesByServerListSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capabilitiesByServerListSample.js @@ -3,25 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists the capabilities available for a given server. + * This sample demonstrates how to lists the capabilities available for a given server. * - * @summary Lists the capabilities available for a given server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByServerList.json + * @summary lists the capabilities available for a given server. + * x-ms-original-file: 2026-01-01-preview/CapabilitiesByServerList.json */ async function listTheCapabilitiesAvailableForAGivenServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.capabilitiesByServer.list(resourceGroupName, serverName)) { + for await (const item of client.capabilitiesByServer.list( + "exampleresourcegroup", + "exampleserver", + )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capturedLogsListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capturedLogsListByServerSample.js similarity index 50% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capturedLogsListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capturedLogsListByServerSample.js index 7d3b337f0803..b6a14c9ad442 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capturedLogsListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/capturedLogsListByServerSample.js @@ -3,25 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all captured logs for download in a server. + * This sample demonstrates how to lists all captured logs for download in a server. * - * @summary Lists all captured logs for download in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapturedLogsListByServer.json + * @summary lists all captured logs for download in a server. + * x-ms-original-file: 2026-01-01-preview/CapturedLogsListByServer.json */ async function listAllCapturedLogsForDownloadInAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.capturedLogs.listByServer(resourceGroupName, serverName)) { + for await (const item of client.capturedLogs.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsGetSample.js similarity index 52% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsGetSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsGetSample.js index 0cecaf83150f..c7b1b7612847 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsGetSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsGetSample.js @@ -3,23 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Gets information about a specific configuration (also known as server parameter) of a server. + * This sample demonstrates how to gets information about a specific configuration (also known as server parameter) of a server. * - * @summary Gets information about a specific configuration (also known as server parameter) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsGet.json + * @summary gets information about a specific configuration (also known as server parameter) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsGet.json */ async function getInformationAboutASpecificConfigurationAlsoKnownAsServerParameterOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const configurationName = "array_nulls"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.configurations.get(resourceGroupName, serverName, configurationName); + const result = await client.configurations.get( + "exampleresourcegroup", + "exampleserver", + "array_nulls", + ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsListByServerSample.js similarity index 53% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsListByServerSample.js index 3068f7c62b84..0a59022d4b49 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsListByServerSample.js @@ -3,25 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all configurations (also known as server parameters) of a server. + * This sample demonstrates how to lists all configurations (also known as server parameters) of a server. * - * @summary Lists all configurations (also known as server parameters) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsListByServer.json + * @summary lists all configurations (also known as server parameters) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsListByServer.json */ async function listAllConfigurationsAlsoKnownAsServerParametersOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.configurations.listByServer(resourceGroupName, serverName)) { + for await (const item of client.configurations.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsPutSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsPutSample.js similarity index 52% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsPutSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsPutSample.js index 05ed77509bda..e83b9e6d40ee 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsPutSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsPutSample.js @@ -3,31 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * This sample demonstrates how to updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. * - * @summary Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdateUsingPut.json + * @summary updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdateUsingPut.json */ async function updateUsingPutVerbTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const configurationName = "constraint_exclusion"; - const parameters = { - source: "user-override", - value: "on", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.configurations.beginPutAndWait( - resourceGroupName, - serverName, - configurationName, - parameters, + const result = await client.configurations.put( + "exampleresourcegroup", + "exampleserver", + "constraint_exclusion", + { source: "user-override", value: "on" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsUpdateSample.js similarity index 50% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsUpdateSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsUpdateSample.js index ec38b1348cf9..e5e2dd57f300 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsUpdateSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/configurationsUpdateSample.js @@ -3,31 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * This sample demonstrates how to updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. * - * @summary Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdate.json + * @summary updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdate.json */ async function updateTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const configurationName = "constraint_exclusion"; - const parameters = { - source: "user-override", - value: "on", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.configurations.beginUpdateAndWait( - resourceGroupName, - serverName, - configurationName, - parameters, + const result = await client.configurations.update( + "exampleresourcegroup", + "exampleserver", + "constraint_exclusion", + { source: "user-override", value: "on" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesCreateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesCreateSample.js new file mode 100644 index 000000000000..a625a31118d4 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesCreateSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates a new database. + * + * @summary creates a new database. + * x-ms-original-file: 2026-01-01-preview/DatabasesCreate.json + */ +async function createADatabase() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.databases.create( + "exampleresourcegroup", + "exampleserver", + "exampledatabase", + { charset: "utf8", collation: "en_US.utf8" }, + ); + console.log(result); +} + +async function main() { + await createADatabase(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesDeleteSample.js new file mode 100644 index 000000000000..b70a076a3fa5 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes an existing database. + * + * @summary deletes an existing database. + * x-ms-original-file: 2026-01-01-preview/DatabasesDelete.json + */ +async function deleteAnExistingDatabase() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.databases.delete("exampleresourcegroup", "exampleserver", "exampledatabase"); +} + +async function main() { + await deleteAnExistingDatabase(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesGetSample.js new file mode 100644 index 000000000000..9314ce5e755f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesGetSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets information about an existing database. + * + * @summary gets information about an existing database. + * x-ms-original-file: 2026-01-01-preview/DatabasesGet.json + */ +async function getInformationAboutAnExistingDatabase() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.databases.get( + "exampleresourcegroup", + "exampleserver", + "exampledatabase", + ); + console.log(result); +} + +async function main() { + await getInformationAboutAnExistingDatabase(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesListByServerSample.js similarity index 50% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesListByServerSample.js index bd6ee41f73d2..ae5d93999b52 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/databasesListByServerSample.js @@ -3,25 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all databases in a server. + * This sample demonstrates how to lists all databases in a server. * - * @summary Lists all databases in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesListByServer.json + * @summary lists all databases in a server. + * x-ms-original-file: 2026-01-01-preview/DatabasesListByServer.json */ async function listAllDatabasesInAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.databases.listByServer(resourceGroupName, serverName)) { + for await (const item of client.databases.listByServer("exampleresourcegroup", "exampleserver")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesCreateOrUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..18c04288e139 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesCreateOrUpdateSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates a new firewall rule or updates an existing firewall rule. + * + * @summary creates a new firewall rule or updates an existing firewall rule. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesCreateOrUpdate.json + */ +async function createANewFirewallRuleOrUpdateAnExistingFirewallRule() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.firewallRules.createOrUpdate( + "exampleresourcegroup", + "exampleserver", + "examplefirewallrule", + { endIpAddress: "255.255.255.255", startIpAddress: "0.0.0.0" }, + ); + console.log(result); +} + +async function main() { + await createANewFirewallRuleOrUpdateAnExistingFirewallRule(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesDeleteSample.js new file mode 100644 index 000000000000..470bc7b15a8f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes an existing firewall rule. + * + * @summary deletes an existing firewall rule. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesDelete.json + */ +async function deleteAnExistingFirewallRule() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.firewallRules.delete("exampleresourcegroup", "exampleserver", "examplefirewallrule"); +} + +async function main() { + await deleteAnExistingFirewallRule(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesGetSample.js new file mode 100644 index 000000000000..e7b0caeaeca3 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesGetSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets information about a firewall rule in a server. + * + * @summary gets information about a firewall rule in a server. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesGet.json + */ +async function getInformationAboutAFirewallRuleInAServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.firewallRules.get( + "exampleresourcegroup", + "exampleserver", + "examplefirewallrule", + ); + console.log(result); +} + +async function main() { + await getInformationAboutAFirewallRuleInAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesListByServerSample.js similarity index 51% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesListByServerSample.js index 408d7d4dccd6..b94d0eee88ad 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/firewallRulesListByServerSample.js @@ -3,25 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists information about all firewall rules in a server. + * This sample demonstrates how to lists information about all firewall rules in a server. * - * @summary Lists information about all firewall rules in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesListByServer.json + * @summary lists information about all firewall rules in a server. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesListByServer.json */ async function listInformationAboutAllFirewallRulesInAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.firewallRules.listByServer(resourceGroupName, serverName)) { + for await (const item of client.firewallRules.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCancelSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCancelSample.js new file mode 100644 index 000000000000..cd9ae9845a10 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCancelSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to cancels an active migration. + * + * @summary cancels an active migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCancel.json + */ +async function cancelAnActiveMigration() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.cancel( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +async function main() { + await cancelAnActiveMigration(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCheckNameAvailabilitySample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCheckNameAvailabilitySample.js similarity index 50% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCheckNameAvailabilitySample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCheckNameAvailabilitySample.js index 1564e44b2187..d3de037f80e4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCheckNameAvailabilitySample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCheckNameAvailabilitySample.js @@ -3,29 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Checks if a proposed migration name is valid and available. + * This sample demonstrates how to checks if a proposed migration name is valid and available. * - * @summary Checks if a proposed migration name is valid and available. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCheckNameAvailability.json + * @summary checks if a proposed migration name is valid and available. + * x-ms-original-file: 2026-01-01-preview/MigrationsCheckNameAvailability.json */ async function checkTheValidityAndAvailabilityOfTheGivenNameToAssignItToANewMigration() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - name: "examplemigration", - type: "Microsoft.DBforPostgreSQL/flexibleServers/migrations", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.checkNameAvailability( - resourceGroupName, - serverName, - parameters, + "exampleresourcegroup", + "exampleserver", + { name: "examplemigration", type: "Microsoft.DBforPostgreSQL/flexibleServers/migrations" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCreateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCreateSample.js new file mode 100644 index 000000000000..f90e1ca66a8b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsCreateSample.js @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreate.json + */ +async function createAMigration() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateOtherSourceTypesValidateMigrate.json + */ +async function createAMigrationWithOtherSourceTypeForValidatingAndMigrating() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + migrationOption: "ValidateAndMigrate", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: "examplesource:5432@exampleuser", + sourceType: "OnPremises", + sslMode: "Prefer", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateValidateOnly.json + */ +async function createAMigrationForValidatingOnly() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + migrationOption: "Validate", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithFullyQualifiedDomainName.json + */ +async function createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { sourceServerPassword: "xxxxxxxx", targetServerPassword: "xxxxxxxx" }, + }, + sourceDbServerFullyQualifiedDomainName: "examplesource.contoso.com", + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + targetDbServerFullyQualifiedDomainName: "exampletarget.contoso.com", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithOtherUsers.json + */ +async function createAMigrationSpecifyingUserNames() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + sourceServerUsername: "newadmin@examplesource", + targetServerUsername: "targetadmin", + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithPrivateEndpointServers.json + */ +async function createAMigrationWithPrivateEndpoint() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationInstanceResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/examplesourcemigration", + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithRoles.json + */ +async function createAMigrationWithRoles() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrateRoles: "True", + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +async function main() { + await createAMigration(); + await createAMigrationWithOtherSourceTypeForValidatingAndMigrating(); + await createAMigrationForValidatingOnly(); + await createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers(); + await createAMigrationSpecifyingUserNames(); + await createAMigrationWithPrivateEndpoint(); + await createAMigrationWithRoles(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsGetSample.js new file mode 100644 index 000000000000..e730b5420ca5 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsGetSample.js @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGet.json + */ +async function getInformationAboutAMigration() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithSuccessfulValidationAndMigration.json + */ +async function getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithSuccessfulValidationButMigrationFailure.json + */ +async function getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithSuccessfulValidationOnly.json + */ +async function getInformationAboutAMigrationWithSuccessfulValidationOnly() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithValidationFailures.json + */ +async function getInformationAboutAMigrationWithValidationFailures() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +async function main() { + await getInformationAboutAMigration(); + await getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration(); + await getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration(); + await getInformationAboutAMigrationWithSuccessfulValidationOnly(); + await getInformationAboutAMigrationWithValidationFailures(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsListByTargetServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsListByTargetServerSample.js similarity index 51% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsListByTargetServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsListByTargetServerSample.js index 004a7212577a..50d080110621 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsListByTargetServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsListByTargetServerSample.js @@ -3,33 +3,26 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all migrations of a target flexible server. + * This sample demonstrates how to lists all migrations of a target flexible server. * - * @summary Lists all migrations of a target flexible server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsListByTargetServer.json + * @summary lists all migrations of a target flexible server. + * x-ms-original-file: 2026-01-01-preview/MigrationsListByTargetServer.json */ async function listAllMigrationsOfATargetFlexibleServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationListFilter = "All"; - const options = { - migrationListFilter, - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.migrations.listByTargetServer( - resourceGroupName, - serverName, - options, + "exampleresourcegroup", + "exampleserver", + { migrationListFilter: "All" }, )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsUpdateSample.js similarity index 55% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsUpdateSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsUpdateSample.js index 29e50798a6ee..7d322757e7c0 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsUpdateSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/migrationsUpdateSample.js @@ -3,30 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. + * This sample demonstrates how to updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. * - * @summary Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsUpdate.json + * @summary updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. + * x-ms-original-file: 2026-01-01-preview/MigrationsUpdate.json */ async function updateAnExistingMigration() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters = { - setupLogicalReplicationOnSourceDbIfNeeded: "True", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.migrations.update( - resourceGroupName, - serverName, - migrationName, - parameters, + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { setupLogicalReplicationOnSourceDbIfNeeded: "True" }, ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/nameAvailabilityCheckGloballySample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/nameAvailabilityCheckGloballySample.js similarity index 66% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/nameAvailabilityCheckGloballySample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/nameAvailabilityCheckGloballySample.js index 052c6336b46b..4e52da26edf9 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/nameAvailabilityCheckGloballySample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/nameAvailabilityCheckGloballySample.js @@ -3,24 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + * This sample demonstrates how to checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. * - * @summary Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckGlobally.json + * @summary checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + * x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckGlobally.json */ async function checkTheValidityAndAvailabilityOfTheGivenNameToAssignItToANewServerOrToUseItAsTheBaseNameOfANewPairOfVirtualEndpoints() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const parameters = { - name: "exampleserver", - type: "Microsoft.DBforPostgreSQL/flexibleServers", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.nameAvailability.checkGlobally(parameters); + const result = await client.nameAvailability.checkGlobally({ + name: "exampleserver", + type: "Microsoft.DBforPostgreSQL/flexibleServers", + }); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/nameAvailabilityCheckWithLocationSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/nameAvailabilityCheckWithLocationSample.js similarity index 64% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/nameAvailabilityCheckWithLocationSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/nameAvailabilityCheckWithLocationSample.js index 9afcb9812782..88d49e17c166 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/nameAvailabilityCheckWithLocationSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/nameAvailabilityCheckWithLocationSample.js @@ -3,25 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Check the availability of name for resource + * This sample demonstrates how to check the availability of name for resource * - * @summary Check the availability of name for resource - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckWithLocation.json + * @summary check the availability of name for resource + * x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckWithLocation.json */ async function checkTheValidityAndAvailabilityOfTheGivenNameInTheGivenLocationToAssignItToANewServerOrToUseItAsTheBaseNameOfANewPairOfVirtualEndpoints() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; - const parameters = { - name: "exampleserver", - type: "Microsoft.DBforPostgreSQL/flexibleServers", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.nameAvailability.checkWithLocation(locationName, parameters); + const result = await client.nameAvailability.checkWithLocation("eastus", { + name: "exampleserver", + type: "Microsoft.DBforPostgreSQL/flexibleServers", + }); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/operationsListSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/operationsListSample.js similarity index 52% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/operationsListSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/operationsListSample.js index 07d9e3e2c0b2..ca25a6398aee 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/operationsListSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/operationsListSample.js @@ -3,28 +3,26 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all available REST API operations. + * This sample demonstrates how to lists all available REST API operations. * - * @summary Lists all available REST API operations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/OperationsList.json + * @summary lists all available REST API operations. + * x-ms-original-file: 2026-01-01-preview/OperationsList.json */ -async function listAllAvailableRestApiOperations() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; +async function listAllAvailableRestAPIOperations() { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const client = new PostgreSQLManagementFlexibleServerClient(credential); const resArray = new Array(); for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } async function main() { - await listAllAvailableRestApiOperations(); + await listAllAvailableRestAPIOperations(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/package.json b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/package.json similarity index 71% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/package.json rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/package.json index ec44e9fdceee..226f820430e6 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/package.json +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/arm-postgresql-flexible-js", + "name": "@azure-samples/arm-postgresql-flexible-js-beta", "private": true, "version": "1.0.0", - "description": " client library samples for JavaScript", + "description": "@azure/arm-postgresql-flexible client library samples for JavaScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -14,10 +14,10 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", - "isomorphic", - "cloud" + "isomorphic" ], "author": "Microsoft Corporation", "license": "MIT", @@ -26,9 +26,9 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible", "dependencies": { - "@azure/arm-postgresql-flexible": "latest", + "@azure/arm-postgresql-flexible": "next", "dotenv": "latest", - "@azure/identity": "^4.11.1" + "@azure/identity": "^4.13.0" }, "devDependencies": { "cross-env": "latest" diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateDnsZoneSuffixGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateDnsZoneSuffixGetSample.js similarity index 59% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateDnsZoneSuffixGetSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateDnsZoneSuffixGetSample.js index 68cf4d2329cb..d97dc8421b11 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateDnsZoneSuffixGetSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateDnsZoneSuffixGetSample.js @@ -3,15 +3,14 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Gets the private DNS zone suffix. + * This sample demonstrates how to gets the private DNS zone suffix. * - * @summary Gets the private DNS zone suffix. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateDnsZoneSuffixGet.json + * @summary gets the private DNS zone suffix. + * x-ms-original-file: 2026-01-01-preview/PrivateDnsZoneSuffixGet.json */ -async function getThePrivateDnsSuffix() { +async function getThePrivateDNSSuffix() { const credential = new DefaultAzureCredential(); const client = new PostgreSQLManagementFlexibleServerClient(credential); const result = await client.privateDnsZoneSuffix.get(); @@ -19,7 +18,7 @@ async function getThePrivateDnsSuffix() { } async function main() { - await getThePrivateDnsSuffix(); + await getThePrivateDNSSuffix(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsDeleteSample.js new file mode 100644 index 000000000000..be6e9d2788c3 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsDeleteSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes a private endpoint connection. + * + * @summary deletes a private endpoint connection. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsDelete.json + */ +async function deleteAPrivateEndpointConnection() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.privateEndpointConnections.delete( + "exampleresourcegroup", + "exampleserver", + "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", + ); +} + +async function main() { + await deleteAPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsGetSample.js similarity index 51% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsGetSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsGetSample.js index eaa56854cfe8..71a97c6e7d96 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsGetSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsGetSample.js @@ -3,27 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Gets a private endpoint connection. + * This sample demonstrates how to gets a private endpoint connection. * - * @summary Gets a private endpoint connection. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsGet.json + * @summary gets a private endpoint connection. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsGet.json */ async function getAPrivateEndpointConnection() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const privateEndpointConnectionName = - "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.privateEndpointConnections.get( - resourceGroupName, - serverName, - privateEndpointConnectionName, + "exampleresourcegroup", + "exampleserver", + "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsListByServerSample.js similarity index 55% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsListByServerSample.js index 5bea68ea66e7..76945c09b54d 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsListByServerSample.js @@ -3,28 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all private endpoint connections on a server. + * This sample demonstrates how to lists all private endpoint connections on a server. * - * @summary Lists all private endpoint connections on a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsList.json + * @summary lists all private endpoint connections on a server. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsList.json */ async function listAllPrivateEndpointConnectionsOnAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.privateEndpointConnections.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsUpdateSample.js new file mode 100644 index 000000000000..b484aac245df --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateEndpointConnectionsUpdateSample.js @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to approves or rejects a private endpoint connection. + * + * @summary approves or rejects a private endpoint connection. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsUpdate.json + */ +async function approveOrRejectAPrivateEndpointConnection() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.update( + "exampleresourcegroup", + "exampleserver", + "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", + { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@contoso.com", + status: "Approved", + }, + }, + ); + console.log(result); +} + +async function main() { + await approveOrRejectAPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateLinkResourcesGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateLinkResourcesGetSample.js new file mode 100644 index 000000000000..85eac9eddec2 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateLinkResourcesGetSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets a private link resource for PostgreSQL server. + * + * @summary gets a private link resource for PostgreSQL server. + * x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesGet.json + */ +async function getsAPrivateLinkResourceForPostgreSQL() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.privateLinkResources.get( + "exampleresourcegroup", + "exampleserver", + "exampleprivatelink", + ); + console.log(result); +} + +async function main() { + await getsAPrivateLinkResourceForPostgreSQL(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateLinkResourcesListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateLinkResourcesListByServerSample.js new file mode 100644 index 000000000000..6499de871708 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/privateLinkResourcesListByServerSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets the private link resources for PostgreSQL server. + * + * @summary gets the private link resources for PostgreSQL server. + * x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesList.json + */ +async function getsPrivateLinkResourcesForPostgreSQL() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.privateLinkResources.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await getsPrivateLinkResourcesForPostgreSQL(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/quotaUsagesListSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/quotaUsagesListSample.js similarity index 56% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/quotaUsagesListSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/quotaUsagesListSample.js index 35632e1bfce3..15bcdbc103d4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/quotaUsagesListSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/quotaUsagesListSample.js @@ -3,24 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Get quota usages at specified location in a given subscription. + * This sample demonstrates how to get quota usages at specified location in a given subscription. * - * @summary Get quota usages at specified location in a given subscription. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/QuotaUsagesForFlexibleServers.json + * @summary get quota usages at specified location in a given subscription. + * x-ms-original-file: 2026-01-01-preview/QuotaUsagesForFlexibleServers.json */ async function listOfQuotaUsagesForServers() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.quotaUsages.list(locationName)) { + for await (const item of client.quotaUsages.list("eastus")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/replicasListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/replicasListByServerSample.js similarity index 50% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/replicasListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/replicasListByServerSample.js index 2d6370d3239c..acb05dd37d8d 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/replicasListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/replicasListByServerSample.js @@ -3,25 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all read replicas of a server. + * This sample demonstrates how to lists all read replicas of a server. * - * @summary Lists all read replicas of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ReplicasListByServer.json + * @summary lists all read replicas of a server. + * x-ms-original-file: 2026-01-01-preview/ReplicasListByServer.json */ async function listAllReadReplicasOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.replicas.listByServer(resourceGroupName, serverName)) { + for await (const item of client.replicas.listByServer("exampleresourcegroup", "exampleserver")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/sample.env b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/sample.env similarity index 100% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/sample.env rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/sample.env diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serverThreatProtectionSettingsCreateOrUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serverThreatProtectionSettingsCreateOrUpdateSample.js new file mode 100644 index 000000000000..d55d3abd7f50 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serverThreatProtectionSettingsCreateOrUpdateSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates or updates a server's Advanced Threat Protection settings. + * + * @summary creates or updates a server's Advanced Threat Protection settings. + * x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsCreateOrUpdate.json + */ +async function updateTheAdvancedThreatProtectionSettingsOfAServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.serverThreatProtectionSettings.createOrUpdate( + "exampleresourcegroup", + "exampleserver", + "Default", + { state: "Enabled" }, + ); + console.log(result); +} + +async function main() { + await updateTheAdvancedThreatProtectionSettingsOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversCreateOrUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversCreateOrUpdateSample.js similarity index 62% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversCreateOrUpdateSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversCreateOrUpdateSample.js index bb5f8d4f01e6..df2540db708d 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversCreateOrUpdateSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversCreateOrUpdateSample.js @@ -3,324 +3,265 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersClusterCreate.json */ async function createANewElasticCluster() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", administratorLogin: "examplelogin", administratorLoginPassword: "examplepassword", backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" }, cluster: { clusterSize: 2, defaultDatabaseName: "clusterdb" }, createMode: "Create", highAvailability: { mode: "Disabled" }, - location: "eastus", network: { publicNetworkAccess: "Disabled" }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 256, tier: "P15" }, version: "16", - }; + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new server. + * + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateGeoRestoreWithDataEncryptionEnabled.json + */ +async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", + createMode: "GeoRestore", + dataEncryption: { + type: "AzureKeyVault", + geoBackupKeyURI: + "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", + geoBackupUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + primaryKeyURI: + "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + primaryUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + }, + pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), + sourceServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new server. + * + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json + */ +async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() { const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", + createMode: "GeoRestore", + dataEncryption: { + type: "AzureKeyVault", + geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", + geoBackupUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + primaryUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + }, + pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), + sourceServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json */ async function createANewServerInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", backup: { backupRetentionDays: 7, geoRedundantBackup: "Enabled" }, createMode: "Create", highAvailability: { mode: "ZoneRedundant" }, - location: "eastus", network: { publicNetworkAccess: "Enabled" }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, - tags: { inCustomerVnet: "false", inMicrosoftVnet: "true" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + tags: { InCustomerVnet: "false", InMicrosoftVnet: "true" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json */ async function createANewServerInYourOwnVirtualNetworkWithSameZoneHighAvailability() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", backup: { backupRetentionDays: 7, geoRedundantBackup: "Enabled" }, createMode: "Create", highAvailability: { mode: "SameZone" }, - location: "eastus", network: { delegatedSubnetResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", privateDnsZoneArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database", }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, - tags: { inCustomerVnet: "true", inMicrosoftVnet: "false" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + tags: { InCustomerVnet: "true", InMicrosoftVnet: "false" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReviveDropped.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreatePointInTimeRestore.json */ -async function createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - createMode: "ReviveDropped", - location: "eastus", - pointInTimeUTC: new Date("2025-06-01T18:30:22.123456Z"), - sourceServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver", - }; +async function createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer() { const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new server. - * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreatePointInTimeRestore.json - */ -async function createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - createMode: "PointInTimeRestore", + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { location: "eastus", + createMode: "PointInTimeRestore", pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), sourceServerResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateReplica.json */ -async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - createMode: "GeoRestore", - dataEncryption: { - type: "AzureKeyVault", - geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", - geoBackupUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", - primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", - primaryUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", - }, +async function createAReadReplicaOfAnExistingServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { identity: { type: "UserAssigned", userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}, }, }, location: "eastus", - pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), - sourceServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new server. - * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabled.json - */ -async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - createMode: "GeoRestore", + createMode: "Replica", dataEncryption: { type: "AzureKeyVault", - geoBackupKeyURI: - "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", - geoBackupUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + geoBackupKeyURI: "", + geoBackupUserAssignedIdentityId: "", primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), sourceServerResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateReviveDropped.json */ -async function createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - administratorLogin: "exampleadministratorlogin", - administratorLoginPassword: "examplepassword", - authConfig: { - activeDirectoryAuth: "Enabled", - passwordAuth: "Enabled", - tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", - }, - availabilityZone: "1", - backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" }, - createMode: "Create", - dataEncryption: { type: "SystemManaged" }, - highAvailability: { mode: "Disabled" }, - location: "eastus", - network: { - delegatedSubnetResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", - privateDnsZoneArmResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", - }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, - storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, - version: "17", - }; +async function createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently() { const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", + createMode: "ReviveDropped", + pointInTimeUTC: new Date("2025-06-01T18:30:22.123456Z"), + sourceServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver", + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabledAutoUpdate.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateWithDataEncryptionEnabled.json */ -async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { +async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", @@ -330,51 +271,44 @@ async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAu type: "AzureKeyVault", geoBackupKeyURI: "", geoBackupUserAssignedIdentityId: "", - primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + primaryKeyURI: + "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, highAvailability: { mode: "ZoneRedundant" }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", network: { delegatedSubnetResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", privateDnsZoneArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabled.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateWithDataEncryptionEnabledAutoUpdate.json */ -async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { +async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", @@ -384,96 +318,73 @@ async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey() { type: "AzureKeyVault", geoBackupKeyURI: "", geoBackupUserAssignedIdentityId: "", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, highAvailability: { mode: "ZoneRedundant" }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", network: { delegatedSubnetResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", privateDnsZoneArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReplica.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json */ -async function createAReadReplicaOfAnExistingServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - createMode: "Replica", - dataEncryption: { - type: "AzureKeyVault", - geoBackupKeyURI: "", - geoBackupUserAssignedIdentityId: "", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - primaryUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", - }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", - pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), - sourceServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; +async function createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability() { const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", + administratorLogin: "exampleadministratorlogin", + administratorLoginPassword: "examplepassword", + authConfig: { + activeDirectoryAuth: "Enabled", + passwordAuth: "Enabled", + tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", + }, + availabilityZone: "1", + backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" }, + createMode: "Create", + dataEncryption: { type: "SystemManaged" }, + highAvailability: { mode: "Disabled" }, + network: { + delegatedSubnetResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", + privateDnsZoneArmResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", + }, + storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, + version: "17", + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); console.log(result); } async function main() { await createANewElasticCluster(); + await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); + await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); await createANewServerInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability(); await createANewServerInYourOwnVirtualNetworkWithSameZoneHighAvailability(); - await createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(); await createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer(); - await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); - await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); - await createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(); - await createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); - await createANewServerWithDataEncryptionBasedOnCustomerManagedKey(); await createAReadReplicaOfAnExistingServer(); + await createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(); + await createANewServerWithDataEncryptionBasedOnCustomerManagedKey(); + await createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); + await createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversDeleteSample.js new file mode 100644 index 000000000000..f123e101dd4d --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes or drops an existing server. + * + * @summary deletes or drops an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersDelete.json + */ +async function deleteOrDropAnExistingServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.delete("exampleresourcegroup", "exampleserver"); +} + +async function main() { + await deleteOrDropAnExistingServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversGetSample.js new file mode 100644 index 000000000000..9d4c01eb27f8 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversGetSample.js @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets information about an existing server. + * + * @summary gets information about an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersGet.json + */ +async function getInformationAboutAnExistingServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.get("exampleresourcegroup", "exampleserver"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about an existing server. + * + * @summary gets information about an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersGetWithPrivateEndpoints.json + */ +async function getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.get("exampleresourcegroup", "exampleserver"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about an existing server. + * + * @summary gets information about an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersGetWithVnet.json + */ +async function getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.get("exampleresourcegroup", "exampleserver"); + console.log(result); +} + +async function main() { + await getInformationAboutAnExistingServer(); + await getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections(); + await getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversListByResourceGroupSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversListByResourceGroupSample.js similarity index 52% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversListByResourceGroupSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversListByResourceGroupSample.js index b3772a182669..ee922043dab4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversListByResourceGroupSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversListByResourceGroupSample.js @@ -3,24 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all servers in a resource group. + * This sample demonstrates how to lists all servers in a resource group. * - * @summary Lists all servers in a resource group. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListByResourceGroup.json + * @summary lists all servers in a resource group. + * x-ms-original-file: 2026-01-01-preview/ServersListByResourceGroup.json */ async function listAllServersInAResourceGroup() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.servers.listByResourceGroup(resourceGroupName)) { + for await (const item of client.servers.listByResourceGroup("exampleresourcegroup")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversListBySubscriptionSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversListBySubscriptionSample.js similarity index 63% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversListBySubscriptionSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversListBySubscriptionSample.js index f2742e7f4dfc..c94d0c1bfe88 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversListBySubscriptionSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversListBySubscriptionSample.js @@ -3,23 +3,22 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists all servers in a subscription. + * This sample demonstrates how to lists all servers in a subscription. * - * @summary Lists all servers in a subscription. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListBySubscription.json + * @summary lists all servers in a subscription. + * x-ms-original-file: 2026-01-01-preview/ServersListBySubscription.json */ async function listAllServersInASubscription() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.servers.listBySubscription()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversMigrateNetworkModeSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversMigrateNetworkModeSample.js new file mode 100644 index 000000000000..a9d432116255 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversMigrateNetworkModeSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. + * + * @summary migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. + * x-ms-original-file: 2026-01-01-preview/ServersMigrateNetworkMode.json + */ +async function migrateServerNetworkConfiguration() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.migrateNetworkMode("exampleresourcegroup", "exampleserver"); + console.log(result); +} + +async function main() { + await migrateServerNetworkConfiguration(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversRestartSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversRestartSample.js new file mode 100644 index 000000000000..9e53adce2b9f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversRestartSample.js @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to restarts PostgreSQL database engine in a server. + * + * @summary restarts PostgreSQL database engine in a server. + * x-ms-original-file: 2026-01-01-preview/ServersRestart.json + */ +async function restartPostgreSQLDatabaseEngineInAServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.restart("exampleresourcegroup", "exampleserver"); +} + +/** + * This sample demonstrates how to restarts PostgreSQL database engine in a server. + * + * @summary restarts PostgreSQL database engine in a server. + * x-ms-original-file: 2026-01-01-preview/ServersRestartWithFailover.json + */ +async function restartPostgreSQLDatabaseEngineInAServerWithAForcedFailoverToStandbyServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.restart("exampleresourcegroup", "exampleserver", { + parameters: { failoverMode: "ForcedFailover", restartWithFailover: true }, + }); +} + +async function main() { + await restartPostgreSQLDatabaseEngineInAServer(); + await restartPostgreSQLDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversStartSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversStartSample.js new file mode 100644 index 000000000000..f2cd82c76212 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversStartSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to starts a stopped server. + * + * @summary starts a stopped server. + * x-ms-original-file: 2026-01-01-preview/ServersStart.json + */ +async function startAStoppedServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.start("exampleresourcegroup", "exampleserver"); +} + +async function main() { + await startAStoppedServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversStopSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversStopSample.js new file mode 100644 index 000000000000..b3580695af55 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversStopSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to stops a server. + * + * @summary stops a server. + * x-ms-original-file: 2026-01-01-preview/ServersStop.json + */ +async function stopAServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.stop("exampleresourcegroup", "exampleserver"); +} + +async function main() { + await stopAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversUpdateSample.js similarity index 55% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversUpdateSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversUpdateSample.js index bad33c751b44..25acdb859576 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversUpdateSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/serversUpdateSample.js @@ -3,214 +3,128 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsForcedStandaloneServer.json */ async function promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - replica: { promoteMode: "Standalone", promoteOption: "Forced" }, - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Standalone", promoteOption: "Forced" }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedStandaloneServer.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsForcedSwitchover.json */ -async function promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - replica: { promoteMode: "Standalone", promoteOption: "Planned" }, - }; +async function switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer() { const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Switchover", promoteOption: "Forced" }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedSwitchover.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsPlannedStandaloneServer.json */ -async function switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - replica: { promoteMode: "Switchover", promoteOption: "Forced" }, - }; +async function promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer() { const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Standalone", promoteOption: "Planned" }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedSwitchover.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsPlannedSwitchover.json */ async function switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - replica: { promoteMode: "Switchover", promoteOption: "Planned" }, - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Switchover", promoteOption: "Planned" }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMajorVersionUpgrade.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdate.json */ -async function updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSqlDatabaseEngine() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { createMode: "Update", version: "17" }; +async function updateAnExistingServer() { const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMicrosoftEntraEnabled.json - */ -async function updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { administratorLoginPassword: "examplenewpassword", - authConfig: { - activeDirectoryAuth: "Enabled", - passwordAuth: "Enabled", - tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", - }, backup: { backupRetentionDays: 20 }, createMode: "Update", + storage: { autoGrow: "Enabled", storageSizeGB: 1024, tier: "P30" }, sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - storage: { autoGrow: "Disabled", storageSizeGB: 1024, tier: "P30" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithCustomMaintenanceWindow.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithCustomMaintenanceWindow.json */ async function updateAnExistingServerWithCustomMaintenanceWindow() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - createMode: "Update", - maintenanceWindow: { - customWindow: "Enabled", - dayOfWeek: 0, - startHour: 8, - startMinute: 0, - }, - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + createMode: "Update", + maintenanceWindow: { customWindow: "Enabled", dayOfWeek: 0, startHour: 8, startMinute: 0 }, + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithDataEncryptionEnabled.json */ -async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - administratorLoginPassword: "examplenewpassword", - backup: { backupRetentionDays: 20 }, - createMode: "Update", - dataEncryption: { - type: "AzureKeyVault", - geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", - geoBackupUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", - primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", - primaryUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", - }, +async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { identity: { type: "UserAssigned", userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}, }, }, - sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabled.json - */ -async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { administratorLoginPassword: "examplenewpassword", backup: { backupRetentionDays: 20 }, createMode: "Update", @@ -225,58 +139,101 @@ async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, + sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json + */ +async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { identity: { type: "UserAssigned", userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}, }, }, + administratorLoginPassword: "examplenewpassword", + backup: { backupRetentionDays: 20 }, + createMode: "Update", + dataEncryption: { + type: "AzureKeyVault", + geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", + geoBackupUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + primaryUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + }, sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - }; + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithMajorVersionUpgrade.json + */ +async function updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSQLDatabaseEngine() { const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + createMode: "Update", + version: "17", + }); console.log(result); } /** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithMicrosoftEntraEnabled.json */ -async function updateAnExistingServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { +async function updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { administratorLoginPassword: "examplenewpassword", + authConfig: { + activeDirectoryAuth: "Enabled", + passwordAuth: "Enabled", + tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", + }, backup: { backupRetentionDays: 20 }, createMode: "Update", + storage: { autoGrow: "Disabled", storageSizeGB: 1024, tier: "P30" }, sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - storage: { autoGrow: "Enabled", storageSizeGB: 1024, tier: "P30" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters); + }); console.log(result); } async function main() { await promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); - await promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); await switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(); + await promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); await switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(); - await updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSqlDatabaseEngine(); - await updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(); + await updateAnExistingServer(); await updateAnExistingServerWithCustomMaintenanceWindow(); - await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); - await updateAnExistingServer(); + await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); + await updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSQLDatabaseEngine(); + await updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsGetSample.js new file mode 100644 index 000000000000..92dd51118782 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets the tuning options of a server. + * + * @summary gets the tuning options of a server. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsGet.json + */ +async function getTheTuningOptionsOfAServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.tuningOptions.get("exampleresourcegroup", "exampleserver", "index"); + console.log(result); +} + +async function main() { + await getTheTuningOptionsOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsListByServerSample.js new file mode 100644 index 000000000000..f8ade5b1fe3e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsListByServerSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists the tuning options of a server. + * + * @summary lists the tuning options of a server. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListByServer.json + */ +async function listTheTuningOptionsOfAServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listTheTuningOptionsOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsListRecommendationsSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsListRecommendationsSample.js new file mode 100644 index 000000000000..a2371f0044a1 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/tuningOptionsListRecommendationsSample.js @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists available object recommendations. + * + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListIndexRecommendations.json + */ +async function listAvailableIndexRecommendations() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "index", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists available object recommendations. + * + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json + */ +async function listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "index", + { recommendationType: "CreateIndex" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists available object recommendations. + * + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListTableRecommendations.json + */ +async function listAvailableTableRecommendations() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "table", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists available object recommendations. + * + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json + */ +async function listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "table", + { recommendationType: "AnalyzeTable" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAvailableIndexRecommendations(); + await listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(); + await listAvailableTableRecommendations(); + await listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsCreateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsCreateSample.js new file mode 100644 index 000000000000..83ca29338389 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsCreateSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates a pair of virtual endpoints for a server. + * + * @summary creates a pair of virtual endpoints for a server. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointCreate.json + */ +async function createAPairOfVirtualEndpointsForAServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.virtualEndpoints.create( + "exampleresourcegroup", + "exampleserver", + "examplebasename", + { endpointType: "ReadWrite", members: ["exampleprimaryserver"] }, + ); + console.log(result); +} + +async function main() { + await createAPairOfVirtualEndpointsForAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsDeleteSample.js new file mode 100644 index 000000000000..b0f8381ab79c --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes a pair of virtual endpoints. + * + * @summary deletes a pair of virtual endpoints. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointDelete.json + */ +async function deleteAPairOfVirtualEndpoints() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.virtualEndpoints.delete("exampleresourcegroup", "exampleserver", "examplebasename"); +} + +async function main() { + await deleteAPairOfVirtualEndpoints(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsGetSample.js similarity index 50% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsGetSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsGetSample.js index 7dce7812cfbd..c96eb00076c5 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsGetSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsGetSample.js @@ -3,26 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Gets information about a pair of virtual endpoints. + * This sample demonstrates how to gets information about a pair of virtual endpoints. * - * @summary Gets information about a pair of virtual endpoints. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsGet.json + * @summary gets information about a pair of virtual endpoints. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointsGet.json */ async function getInformationAboutAPairOfVirtualEndpoints() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const result = await client.virtualEndpoints.get( - resourceGroupName, - serverName, - virtualEndpointName, + "exampleresourcegroup", + "exampleserver", + "examplebasename", ); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsListByServerSample.js similarity index 56% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsListByServerSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsListByServerSample.js index 8f114a1f7b1d..157641577448 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsListByServerSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsListByServerSample.js @@ -3,25 +3,25 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists pair of virtual endpoints associated to a server. + * This sample demonstrates how to lists pair of virtual endpoints associated to a server. * - * @summary Lists pair of virtual endpoints associated to a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsListByServer.json + * @summary lists pair of virtual endpoints associated to a server. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointsListByServer.json */ async function listPairOfVirtualEndpointsAssociatedToAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.virtualEndpoints.listByServer(resourceGroupName, serverName)) { + for await (const item of client.virtualEndpoints.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsUpdateSample.js new file mode 100644 index 000000000000..9f78ef682e01 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualEndpointsUpdateSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to updates a pair of virtual endpoints for a server. + * + * @summary updates a pair of virtual endpoints for a server. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointUpdate.json + */ +async function updateAPairOfVirtualEndpointsForAServer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.virtualEndpoints.update( + "exampleresourcegroup", + "exampleserver", + "examplebasename", + { endpointType: "ReadWrite", members: ["exampleprimaryserver"] }, + ); + console.log(result); +} + +async function main() { + await updateAPairOfVirtualEndpointsForAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualNetworkSubnetUsageListSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualNetworkSubnetUsageListSample.js similarity index 60% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualNetworkSubnetUsageListSample.js rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualNetworkSubnetUsageListSample.js index 3619fdc8ee5d..b107dea6f30f 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualNetworkSubnetUsageListSample.js +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/javascript/virtualNetworkSubnetUsageListSample.js @@ -3,25 +3,21 @@ const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); /** - * This sample demonstrates how to Lists the virtual network subnet usage for a given virtual network. + * This sample demonstrates how to lists the virtual network subnet usage for a given virtual network. * - * @summary Lists the virtual network subnet usage for a given virtual network. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualNetworkSubnetUsageList.json + * @summary lists the virtual network subnet usage for a given virtual network. + * x-ms-original-file: 2026-01-01-preview/VirtualNetworkSubnetUsageList.json */ async function listTheVirtualNetworkSubnetUsageForAGivenVirtualNetwork() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; - const parameters = { - virtualNetworkArmResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork", - }; const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.virtualNetworkSubnetUsage.list(locationName, parameters); + const result = await client.virtualNetworkSubnetUsage.list("eastus", { + virtualNetworkArmResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork", + }); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/README.md b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/README.md new file mode 100644 index 000000000000..18c80dd8c9f9 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/README.md @@ -0,0 +1,195 @@ +# @azure/arm-postgresql-flexible client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for @azure/arm-postgresql-flexible in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [administratorsMicrosoftEntraCreateOrUpdateSample.ts][administratorsmicrosoftentracreateorupdatesample] | creates a new server administrator associated to a Microsoft Entra principal. x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraAdd.json | +| [administratorsMicrosoftEntraDeleteSample.ts][administratorsmicrosoftentradeletesample] | deletes an existing server administrator associated to a Microsoft Entra principal. x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraDelete.json | +| [administratorsMicrosoftEntraGetSample.ts][administratorsmicrosoftentragetsample] | gets information about a server administrator associated to a Microsoft Entra principal. x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraGet.json | +| [administratorsMicrosoftEntraListByServerSample.ts][administratorsmicrosoftentralistbyserversample] | list all server administrators associated to a Microsoft Entra principal. x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraListByServer.json | +| [advancedThreatProtectionSettingsGetSample.ts][advancedthreatprotectionsettingsgetsample] | gets state of advanced threat protection settings for a server. x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsGet.json | +| [advancedThreatProtectionSettingsListByServerSample.ts][advancedthreatprotectionsettingslistbyserversample] | lists state of advanced threat protection settings for a server. x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsListByServer.json | +| [backupsAutomaticAndOnDemandCreateSample.ts][backupsautomaticandondemandcreatesample] | creates an on demand backup of a server. x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandCreate.json | +| [backupsAutomaticAndOnDemandDeleteSample.ts][backupsautomaticandondemanddeletesample] | deletes a specific backup, given its name. x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandDelete.json | +| [backupsAutomaticAndOnDemandGetSample.ts][backupsautomaticandondemandgetsample] | gets information of an on demand backup, given its name. x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandGet.json | +| [backupsAutomaticAndOnDemandListByServerSample.ts][backupsautomaticandondemandlistbyserversample] | lists all available backups of a server. x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandListByServer.json | +| [backupsLongTermRetentionCheckPrerequisitesSample.ts][backupslongtermretentioncheckprerequisitessample] | performs all checks required for a long term retention backup operation to succeed. x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionCheckPrerequisites.json | +| [backupsLongTermRetentionGetSample.ts][backupslongtermretentiongetsample] | gets the results of a long retention backup operation for a server. x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionGet.json | +| [backupsLongTermRetentionListByServerSample.ts][backupslongtermretentionlistbyserversample] | lists the results of the long term retention backup operations for a server. x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionListByServer.json | +| [backupsLongTermRetentionStartSample.ts][backupslongtermretentionstartsample] | initiates a long term retention backup. x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionStart.json | +| [capabilitiesByLocationListSample.ts][capabilitiesbylocationlistsample] | lists the capabilities available in a given location for a specific subscription. x-ms-original-file: 2026-01-01-preview/CapabilitiesByLocationList.json | +| [capabilitiesByServerListSample.ts][capabilitiesbyserverlistsample] | lists the capabilities available for a given server. x-ms-original-file: 2026-01-01-preview/CapabilitiesByServerList.json | +| [capturedLogsListByServerSample.ts][capturedlogslistbyserversample] | lists all captured logs for download in a server. x-ms-original-file: 2026-01-01-preview/CapturedLogsListByServer.json | +| [configurationsGetSample.ts][configurationsgetsample] | gets information about a specific configuration (also known as server parameter) of a server. x-ms-original-file: 2026-01-01-preview/ConfigurationsGet.json | +| [configurationsListByServerSample.ts][configurationslistbyserversample] | lists all configurations (also known as server parameters) of a server. x-ms-original-file: 2026-01-01-preview/ConfigurationsListByServer.json | +| [configurationsPutSample.ts][configurationsputsample] | updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdateUsingPut.json | +| [configurationsUpdateSample.ts][configurationsupdatesample] | updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdate.json | +| [databasesCreateSample.ts][databasescreatesample] | creates a new database. x-ms-original-file: 2026-01-01-preview/DatabasesCreate.json | +| [databasesDeleteSample.ts][databasesdeletesample] | deletes an existing database. x-ms-original-file: 2026-01-01-preview/DatabasesDelete.json | +| [databasesGetSample.ts][databasesgetsample] | gets information about an existing database. x-ms-original-file: 2026-01-01-preview/DatabasesGet.json | +| [databasesListByServerSample.ts][databaseslistbyserversample] | lists all databases in a server. x-ms-original-file: 2026-01-01-preview/DatabasesListByServer.json | +| [firewallRulesCreateOrUpdateSample.ts][firewallrulescreateorupdatesample] | creates a new firewall rule or updates an existing firewall rule. x-ms-original-file: 2026-01-01-preview/FirewallRulesCreateOrUpdate.json | +| [firewallRulesDeleteSample.ts][firewallrulesdeletesample] | deletes an existing firewall rule. x-ms-original-file: 2026-01-01-preview/FirewallRulesDelete.json | +| [firewallRulesGetSample.ts][firewallrulesgetsample] | gets information about a firewall rule in a server. x-ms-original-file: 2026-01-01-preview/FirewallRulesGet.json | +| [firewallRulesListByServerSample.ts][firewallruleslistbyserversample] | lists information about all firewall rules in a server. x-ms-original-file: 2026-01-01-preview/FirewallRulesListByServer.json | +| [migrationsCancelSample.ts][migrationscancelsample] | cancels an active migration. x-ms-original-file: 2026-01-01-preview/MigrationsCancel.json | +| [migrationsCheckNameAvailabilitySample.ts][migrationschecknameavailabilitysample] | checks if a proposed migration name is valid and available. x-ms-original-file: 2026-01-01-preview/MigrationsCheckNameAvailability.json | +| [migrationsCreateSample.ts][migrationscreatesample] | creates a new migration. x-ms-original-file: 2026-01-01-preview/MigrationsCreate.json | +| [migrationsGetSample.ts][migrationsgetsample] | gets information about a migration. x-ms-original-file: 2026-01-01-preview/MigrationsGet.json | +| [migrationsListByTargetServerSample.ts][migrationslistbytargetserversample] | lists all migrations of a target flexible server. x-ms-original-file: 2026-01-01-preview/MigrationsListByTargetServer.json | +| [migrationsUpdateSample.ts][migrationsupdatesample] | updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. x-ms-original-file: 2026-01-01-preview/MigrationsUpdate.json | +| [nameAvailabilityCheckGloballySample.ts][nameavailabilitycheckgloballysample] | checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckGlobally.json | +| [nameAvailabilityCheckWithLocationSample.ts][nameavailabilitycheckwithlocationsample] | check the availability of name for resource x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckWithLocation.json | +| [operationsListSample.ts][operationslistsample] | lists all available REST API operations. x-ms-original-file: 2026-01-01-preview/OperationsList.json | +| [privateDnsZoneSuffixGetSample.ts][privatednszonesuffixgetsample] | gets the private DNS zone suffix. x-ms-original-file: 2026-01-01-preview/PrivateDnsZoneSuffixGet.json | +| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | deletes a private endpoint connection. x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsDelete.json | +| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | gets a private endpoint connection. x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsGet.json | +| [privateEndpointConnectionsListByServerSample.ts][privateendpointconnectionslistbyserversample] | lists all private endpoint connections on a server. x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsList.json | +| [privateEndpointConnectionsUpdateSample.ts][privateendpointconnectionsupdatesample] | approves or rejects a private endpoint connection. x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsUpdate.json | +| [privateLinkResourcesGetSample.ts][privatelinkresourcesgetsample] | gets a private link resource for PostgreSQL server. x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesGet.json | +| [privateLinkResourcesListByServerSample.ts][privatelinkresourceslistbyserversample] | gets the private link resources for PostgreSQL server. x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesList.json | +| [quotaUsagesListSample.ts][quotausageslistsample] | get quota usages at specified location in a given subscription. x-ms-original-file: 2026-01-01-preview/QuotaUsagesForFlexibleServers.json | +| [replicasListByServerSample.ts][replicaslistbyserversample] | lists all read replicas of a server. x-ms-original-file: 2026-01-01-preview/ReplicasListByServer.json | +| [serverThreatProtectionSettingsCreateOrUpdateSample.ts][serverthreatprotectionsettingscreateorupdatesample] | creates or updates a server's Advanced Threat Protection settings. x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsCreateOrUpdate.json | +| [serversCreateOrUpdateSample.ts][serverscreateorupdatesample] | creates a new server. x-ms-original-file: 2026-01-01-preview/ServersClusterCreate.json | +| [serversDeleteSample.ts][serversdeletesample] | deletes or drops an existing server. x-ms-original-file: 2026-01-01-preview/ServersDelete.json | +| [serversGetSample.ts][serversgetsample] | gets information about an existing server. x-ms-original-file: 2026-01-01-preview/ServersGet.json | +| [serversListByResourceGroupSample.ts][serverslistbyresourcegroupsample] | lists all servers in a resource group. x-ms-original-file: 2026-01-01-preview/ServersListByResourceGroup.json | +| [serversListBySubscriptionSample.ts][serverslistbysubscriptionsample] | lists all servers in a subscription. x-ms-original-file: 2026-01-01-preview/ServersListBySubscription.json | +| [serversMigrateNetworkModeSample.ts][serversmigratenetworkmodesample] | migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. x-ms-original-file: 2026-01-01-preview/ServersMigrateNetworkMode.json | +| [serversRestartSample.ts][serversrestartsample] | restarts PostgreSQL database engine in a server. x-ms-original-file: 2026-01-01-preview/ServersRestart.json | +| [serversStartSample.ts][serversstartsample] | starts a stopped server. x-ms-original-file: 2026-01-01-preview/ServersStart.json | +| [serversStopSample.ts][serversstopsample] | stops a server. x-ms-original-file: 2026-01-01-preview/ServersStop.json | +| [serversUpdateSample.ts][serversupdatesample] | updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsForcedStandaloneServer.json | +| [tuningOptionsGetSample.ts][tuningoptionsgetsample] | gets the tuning options of a server. x-ms-original-file: 2026-01-01-preview/TuningOptionsGet.json | +| [tuningOptionsListByServerSample.ts][tuningoptionslistbyserversample] | lists the tuning options of a server. x-ms-original-file: 2026-01-01-preview/TuningOptionsListByServer.json | +| [tuningOptionsListRecommendationsSample.ts][tuningoptionslistrecommendationssample] | lists available object recommendations. x-ms-original-file: 2026-01-01-preview/TuningOptionsListIndexRecommendations.json | +| [virtualEndpointsCreateSample.ts][virtualendpointscreatesample] | creates a pair of virtual endpoints for a server. x-ms-original-file: 2026-01-01-preview/VirtualEndpointCreate.json | +| [virtualEndpointsDeleteSample.ts][virtualendpointsdeletesample] | deletes a pair of virtual endpoints. x-ms-original-file: 2026-01-01-preview/VirtualEndpointDelete.json | +| [virtualEndpointsGetSample.ts][virtualendpointsgetsample] | gets information about a pair of virtual endpoints. x-ms-original-file: 2026-01-01-preview/VirtualEndpointsGet.json | +| [virtualEndpointsListByServerSample.ts][virtualendpointslistbyserversample] | lists pair of virtual endpoints associated to a server. x-ms-original-file: 2026-01-01-preview/VirtualEndpointsListByServer.json | +| [virtualEndpointsUpdateSample.ts][virtualendpointsupdatesample] | updates a pair of virtual endpoints for a server. x-ms-original-file: 2026-01-01-preview/VirtualEndpointUpdate.json | +| [virtualNetworkSubnetUsageListSample.ts][virtualnetworksubnetusagelistsample] | lists the virtual network subnet usage for a given virtual network. x-ms-original-file: 2026-01-01-preview/VirtualNetworkSubnetUsageList.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/administratorsMicrosoftEntraCreateOrUpdateSample.js +``` + +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +node dist/administratorsMicrosoftEntraCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[administratorsmicrosoftentracreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraCreateOrUpdateSample.ts +[administratorsmicrosoftentradeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraDeleteSample.ts +[administratorsmicrosoftentragetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraGetSample.ts +[administratorsmicrosoftentralistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraListByServerSample.ts +[advancedthreatprotectionsettingsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/advancedThreatProtectionSettingsGetSample.ts +[advancedthreatprotectionsettingslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/advancedThreatProtectionSettingsListByServerSample.ts +[backupsautomaticandondemandcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandCreateSample.ts +[backupsautomaticandondemanddeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandDeleteSample.ts +[backupsautomaticandondemandgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandGetSample.ts +[backupsautomaticandondemandlistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandListByServerSample.ts +[backupslongtermretentioncheckprerequisitessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionCheckPrerequisitesSample.ts +[backupslongtermretentiongetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionGetSample.ts +[backupslongtermretentionlistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionListByServerSample.ts +[backupslongtermretentionstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionStartSample.ts +[capabilitiesbylocationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capabilitiesByLocationListSample.ts +[capabilitiesbyserverlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capabilitiesByServerListSample.ts +[capturedlogslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capturedLogsListByServerSample.ts +[configurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsGetSample.ts +[configurationslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsListByServerSample.ts +[configurationsputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsPutSample.ts +[configurationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsUpdateSample.ts +[databasescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesCreateSample.ts +[databasesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesDeleteSample.ts +[databasesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesGetSample.ts +[databaseslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesListByServerSample.ts +[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts +[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesDeleteSample.ts +[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesGetSample.ts +[firewallruleslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesListByServerSample.ts +[migrationscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCancelSample.ts +[migrationschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCheckNameAvailabilitySample.ts +[migrationscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCreateSample.ts +[migrationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsGetSample.ts +[migrationslistbytargetserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsListByTargetServerSample.ts +[migrationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsUpdateSample.ts +[nameavailabilitycheckgloballysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/nameAvailabilityCheckGloballySample.ts +[nameavailabilitycheckwithlocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/nameAvailabilityCheckWithLocationSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/operationsListSample.ts +[privatednszonesuffixgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateDnsZoneSuffixGetSample.ts +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsGetSample.ts +[privateendpointconnectionslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsListByServerSample.ts +[privateendpointconnectionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsUpdateSample.ts +[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateLinkResourcesGetSample.ts +[privatelinkresourceslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateLinkResourcesListByServerSample.ts +[quotausageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/quotaUsagesListSample.ts +[replicaslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/replicasListByServerSample.ts +[serverthreatprotectionsettingscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serverThreatProtectionSettingsCreateOrUpdateSample.ts +[serverscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversCreateOrUpdateSample.ts +[serversdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversDeleteSample.ts +[serversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversGetSample.ts +[serverslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversListByResourceGroupSample.ts +[serverslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversListBySubscriptionSample.ts +[serversmigratenetworkmodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversMigrateNetworkModeSample.ts +[serversrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversRestartSample.ts +[serversstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversStartSample.ts +[serversstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversStopSample.ts +[serversupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversUpdateSample.ts +[tuningoptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsGetSample.ts +[tuningoptionslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsListByServerSample.ts +[tuningoptionslistrecommendationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsListRecommendationsSample.ts +[virtualendpointscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsCreateSample.ts +[virtualendpointsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsDeleteSample.ts +[virtualendpointsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsGetSample.ts +[virtualendpointslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsListByServerSample.ts +[virtualendpointsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsUpdateSample.ts +[virtualnetworksubnetusagelistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualNetworkSubnetUsageListSample.ts +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-postgresql-flexible?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/package.json b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/package.json similarity index 75% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/package.json rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/package.json index 18e0dbfc9e34..2be188fda870 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/package.json +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/arm-postgresql-flexible-ts", + "name": "@azure-samples/arm-postgresql-flexible-ts-beta", "private": true, "version": "1.0.0", - "description": " client library samples for TypeScript", + "description": "@azure/arm-postgresql-flexible client library samples for TypeScript (Beta)", "engines": { "node": ">=20.0.0" }, @@ -18,10 +18,10 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", - "isomorphic", - "cloud" + "isomorphic" ], "author": "Microsoft Corporation", "license": "MIT", @@ -30,9 +30,9 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible", "dependencies": { - "@azure/arm-postgresql-flexible": "latest", + "@azure/arm-postgresql-flexible": "next", "dotenv": "latest", - "@azure/identity": "^4.11.1" + "@azure/identity": "^4.13.0" }, "devDependencies": { "@types/node": "^20.0.0", diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/sample.env b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/sample.env similarity index 100% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/sample.env rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/sample.env diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraCreateOrUpdateSample.ts new file mode 100644 index 000000000000..400b569c7304 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraCreateOrUpdateSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates a new server administrator associated to a Microsoft Entra principal. + * + * @summary creates a new server administrator associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraAdd.json + */ +async function addAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.administratorsMicrosoftEntra.createOrUpdate( + "exampleresourcegroup", + "exampleserver", + "oooooooo-oooo-oooo-oooo-oooooooooooo", + { + principalName: "exampleuser@contoso.com", + principalType: "User", + tenantId: "tttttttt-tttt-tttt-tttt-tttttttttttt", + }, + ); + console.log(result); +} + +async function main(): Promise { + await addAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraDeleteSample.ts new file mode 100644 index 000000000000..7091cc36333c --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraDeleteSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes an existing server administrator associated to a Microsoft Entra principal. + * + * @summary deletes an existing server administrator associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraDelete.json + */ +async function deleteAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.administratorsMicrosoftEntra.delete( + "exampleresourcegroup", + "exampleserver", + "oooooooo-oooo-oooo-oooo-oooooooooooo", + ); +} + +async function main(): Promise { + await deleteAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraGetSample.ts new file mode 100644 index 000000000000..d152d8a99651 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a server administrator associated to a Microsoft Entra principal. + * + * @summary gets information about a server administrator associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraGet.json + */ +async function getInformationAboutAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.administratorsMicrosoftEntra.get( + "exampleresourcegroup", + "exampleserver", + "oooooooo-oooo-oooo-oooo-oooooooooooo", + ); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraListByServerSample.ts similarity index 52% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraListByServerSample.ts rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraListByServerSample.ts index 9bcb8b999144..97fe86f231c0 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/administratorsMicrosoftEntraListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List all server administrators associated to a Microsoft Entra principal. + * This sample demonstrates how to list all server administrators associated to a Microsoft Entra principal. * - * @summary List all server administrators associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraListByServer.json + * @summary list all server administrators associated to a Microsoft Entra principal. + * x-ms-original-file: 2026-01-01-preview/AdministratorsMicrosoftEntraListByServer.json */ async function listInformationAboutAllServerAdministratorsAssociatedToMicrosoftEntraPrincipals(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.administratorsMicrosoftEntra.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/advancedThreatProtectionSettingsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/advancedThreatProtectionSettingsGetSample.ts new file mode 100644 index 000000000000..815920192c85 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/advancedThreatProtectionSettingsGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets state of advanced threat protection settings for a server. + * + * @summary gets state of advanced threat protection settings for a server. + * x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsGet.json + */ +async function getStateOfAdvancedThreatProtectionSettingsForAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.advancedThreatProtectionSettings.get( + "exampleresourcegroup", + "exampleserver", + "Default", + ); + console.log(result); +} + +async function main(): Promise { + await getStateOfAdvancedThreatProtectionSettingsForAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/advancedThreatProtectionSettingsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/advancedThreatProtectionSettingsListByServerSample.ts similarity index 50% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/advancedThreatProtectionSettingsListByServerSample.ts rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/advancedThreatProtectionSettingsListByServerSample.ts index 424ce6d901e2..61540e82a51a 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/advancedThreatProtectionSettingsListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/advancedThreatProtectionSettingsListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists state of advanced threat protection settings for a server. + * This sample demonstrates how to lists state of advanced threat protection settings for a server. * - * @summary Lists state of advanced threat protection settings for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsListByServer.json + * @summary lists state of advanced threat protection settings for a server. + * x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsListByServer.json */ async function listStateOfAdvancedThreatProtectionSettingsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.advancedThreatProtectionSettings.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandCreateSample.ts new file mode 100644 index 000000000000..986d1d299c82 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandCreateSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates an on demand backup of a server. + * + * @summary creates an on demand backup of a server. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandCreate.json + */ +async function createAnOnDemandBackupOfAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.backupsAutomaticAndOnDemand.create( + "exampleresourcegroup", + "exampleserver", + "ondemandbackup-20250601T183022", + ); + console.log(result); +} + +async function main(): Promise { + await createAnOnDemandBackupOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandDeleteSample.ts new file mode 100644 index 000000000000..4717aa593fb5 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandDeleteSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes a specific backup, given its name. + * + * @summary deletes a specific backup, given its name. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandDelete.json + */ +async function deleteAnOnDemandBackupGivenItsName(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.backupsAutomaticAndOnDemand.delete( + "exampleresourcegroup", + "exampleserver", + "ondemandbackup-20250601T183022", + ); +} + +async function main(): Promise { + await deleteAnOnDemandBackupGivenItsName(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandGetSample.ts new file mode 100644 index 000000000000..818142fc654a --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information of an on demand backup, given its name. + * + * @summary gets information of an on demand backup, given its name. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandGet.json + */ +async function getAnOnDemandBackupGivenItsName(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.backupsAutomaticAndOnDemand.get( + "exampleresourcegroup", + "exampleserver", + "backup_638830782181266873", + ); + console.log(result); +} + +async function main(): Promise { + await getAnOnDemandBackupGivenItsName(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandListByServerSample.ts new file mode 100644 index 000000000000..1dfe364676e8 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsAutomaticAndOnDemandListByServerSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all available backups of a server. + * + * @summary lists all available backups of a server. + * x-ms-original-file: 2026-01-01-preview/BackupsAutomaticAndOnDemandListByServer.json + */ +async function listAllAvailableBackupsOfAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.backupsAutomaticAndOnDemand.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllAvailableBackupsOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionCheckPrerequisitesSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionCheckPrerequisitesSample.ts new file mode 100644 index 000000000000..eba1eecbdc85 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionCheckPrerequisitesSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to performs all checks required for a long term retention backup operation to succeed. + * + * @summary performs all checks required for a long term retention backup operation to succeed. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionCheckPrerequisites.json + */ +async function performAllChecksRequiredForALongTermRetentionBackupOperationToSucceed(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.backupsLongTermRetention.checkPrerequisites( + "exampleresourcegroup", + "exampleserver", + { backupSettings: { backupName: "exampleltrbackup" } }, + ); + console.log(result); +} + +async function main(): Promise { + await performAllChecksRequiredForALongTermRetentionBackupOperationToSucceed(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionGetSample.ts new file mode 100644 index 000000000000..314c348a201f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the results of a long retention backup operation for a server. + * + * @summary gets the results of a long retention backup operation for a server. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionGet.json + */ +async function getTheResultsOfALongRetentionBackupOperationForAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.backupsLongTermRetention.get( + "exampleresourcegroup", + "exampleserver", + "exampleltrbackup", + ); + console.log(result); +} + +async function main(): Promise { + await getTheResultsOfALongRetentionBackupOperationForAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionListByServerSample.ts similarity index 52% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionListByServerSample.ts rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionListByServerSample.ts index 705af0e90971..47d2232a8fe1 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the results of the long term retention backup operations for a server. + * This sample demonstrates how to lists the results of the long term retention backup operations for a server. * - * @summary Lists the results of the long term retention backup operations for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionListByServer.json + * @summary lists the results of the long term retention backup operations for a server. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionListByServer.json */ async function listTheResultsOfTheLongTermRetentionBackupOperationsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.backupsLongTermRetention.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionStartSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionStartSample.ts new file mode 100644 index 000000000000..89a085c27ca5 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/backupsLongTermRetentionStartSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to initiates a long term retention backup. + * + * @summary initiates a long term retention backup. + * x-ms-original-file: 2026-01-01-preview/BackupsLongTermRetentionStart.json + */ +async function initiateALongTermRetentionBackup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.backupsLongTermRetention.start( + "exampleresourcegroup", + "exampleserver", + { + backupSettings: { backupName: "exampleltrbackup" }, + targetDetails: { sasUriList: ["sasuri"] }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await initiateALongTermRetentionBackup(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capabilitiesByLocationListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capabilitiesByLocationListSample.ts similarity index 52% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capabilitiesByLocationListSample.ts rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capabilitiesByLocationListSample.ts index abbbf80ade20..6430184fb320 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capabilitiesByLocationListSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capabilitiesByLocationListSample.ts @@ -3,28 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists the capabilities available in a given location for a specific subscription. + * This sample demonstrates how to lists the capabilities available in a given location for a specific subscription. * - * @summary Lists the capabilities available in a given location for a specific subscription. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByLocationList.json + * @summary lists the capabilities available in a given location for a specific subscription. + * x-ms-original-file: 2026-01-01-preview/CapabilitiesByLocationList.json */ async function listTheCapabilitiesAvailableInAGivenLocationForASpecificSubscription(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.capabilitiesByLocation.list(locationName)) { + for await (const item of client.capabilitiesByLocation.list("eastus")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capabilitiesByServerListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capabilitiesByServerListSample.ts new file mode 100644 index 000000000000..1687ec8e1c5b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capabilitiesByServerListSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists the capabilities available for a given server. + * + * @summary lists the capabilities available for a given server. + * x-ms-original-file: 2026-01-01-preview/CapabilitiesByServerList.json + */ +async function listTheCapabilitiesAvailableForAGivenServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.capabilitiesByServer.list( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listTheCapabilitiesAvailableForAGivenServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capturedLogsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capturedLogsListByServerSample.ts new file mode 100644 index 000000000000..d718f3dc5572 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/capturedLogsListByServerSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all captured logs for download in a server. + * + * @summary lists all captured logs for download in a server. + * x-ms-original-file: 2026-01-01-preview/CapturedLogsListByServer.json + */ +async function listAllCapturedLogsForDownloadInAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.capturedLogs.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllCapturedLogsForDownloadInAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsGetSample.ts new file mode 100644 index 000000000000..6d78f414e3b1 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a specific configuration (also known as server parameter) of a server. + * + * @summary gets information about a specific configuration (also known as server parameter) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsGet.json + */ +async function getInformationAboutASpecificConfigurationAlsoKnownAsServerParameterOfAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.configurations.get( + "exampleresourcegroup", + "exampleserver", + "array_nulls", + ); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutASpecificConfigurationAlsoKnownAsServerParameterOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsListByServerSample.ts similarity index 51% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsListByServerSample.ts rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsListByServerSample.ts index 6227395602c2..caece9e0e863 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsListByServerSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsListByServerSample.ts @@ -3,33 +3,25 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all configurations (also known as server parameters) of a server. + * This sample demonstrates how to lists all configurations (also known as server parameters) of a server. * - * @summary Lists all configurations (also known as server parameters) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsListByServer.json + * @summary lists all configurations (also known as server parameters) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsListByServer.json */ async function listAllConfigurationsAlsoKnownAsServerParametersOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.configurations.listByServer( - resourceGroupName, - serverName, + "exampleresourcegroup", + "exampleserver", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsPutSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsPutSample.ts new file mode 100644 index 000000000000..dbc629362897 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsPutSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * + * @summary updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdateUsingPut.json + */ +async function updateUsingPutVerbTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.configurations.put( + "exampleresourcegroup", + "exampleserver", + "constraint_exclusion", + { source: "user-override", value: "on" }, + ); + console.log(result); +} + +async function main(): Promise { + await updateUsingPutVerbTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsUpdateSample.ts new file mode 100644 index 000000000000..31ee174dcd7c --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/configurationsUpdateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * + * @summary updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. + * x-ms-original-file: 2026-01-01-preview/ConfigurationsUpdate.json + */ +async function updateTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.configurations.update( + "exampleresourcegroup", + "exampleserver", + "constraint_exclusion", + { source: "user-override", value: "on" }, + ); + console.log(result); +} + +async function main(): Promise { + await updateTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesCreateSample.ts new file mode 100644 index 000000000000..079cb1a7361f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesCreateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates a new database. + * + * @summary creates a new database. + * x-ms-original-file: 2026-01-01-preview/DatabasesCreate.json + */ +async function createADatabase(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.databases.create( + "exampleresourcegroup", + "exampleserver", + "exampledatabase", + { charset: "utf8", collation: "en_US.utf8" }, + ); + console.log(result); +} + +async function main(): Promise { + await createADatabase(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesDeleteSample.ts new file mode 100644 index 000000000000..ac4fb23606c0 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes an existing database. + * + * @summary deletes an existing database. + * x-ms-original-file: 2026-01-01-preview/DatabasesDelete.json + */ +async function deleteAnExistingDatabase(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.databases.delete("exampleresourcegroup", "exampleserver", "exampledatabase"); +} + +async function main(): Promise { + await deleteAnExistingDatabase(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesGetSample.ts new file mode 100644 index 000000000000..e099a042e983 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about an existing database. + * + * @summary gets information about an existing database. + * x-ms-original-file: 2026-01-01-preview/DatabasesGet.json + */ +async function getInformationAboutAnExistingDatabase(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.databases.get( + "exampleresourcegroup", + "exampleserver", + "exampledatabase", + ); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutAnExistingDatabase(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesListByServerSample.ts new file mode 100644 index 000000000000..7f13e8bacc1d --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/databasesListByServerSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all databases in a server. + * + * @summary lists all databases in a server. + * x-ms-original-file: 2026-01-01-preview/DatabasesListByServer.json + */ +async function listAllDatabasesInAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.databases.listByServer("exampleresourcegroup", "exampleserver")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllDatabasesInAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..c8db1118e434 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates a new firewall rule or updates an existing firewall rule. + * + * @summary creates a new firewall rule or updates an existing firewall rule. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesCreateOrUpdate.json + */ +async function createANewFirewallRuleOrUpdateAnExistingFirewallRule(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.firewallRules.createOrUpdate( + "exampleresourcegroup", + "exampleserver", + "examplefirewallrule", + { endIpAddress: "255.255.255.255", startIpAddress: "0.0.0.0" }, + ); + console.log(result); +} + +async function main(): Promise { + await createANewFirewallRuleOrUpdateAnExistingFirewallRule(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesDeleteSample.ts new file mode 100644 index 000000000000..370ee5ac1bc0 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes an existing firewall rule. + * + * @summary deletes an existing firewall rule. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesDelete.json + */ +async function deleteAnExistingFirewallRule(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.firewallRules.delete("exampleresourcegroup", "exampleserver", "examplefirewallrule"); +} + +async function main(): Promise { + await deleteAnExistingFirewallRule(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesGetSample.ts new file mode 100644 index 000000000000..c16d148a9657 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a firewall rule in a server. + * + * @summary gets information about a firewall rule in a server. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesGet.json + */ +async function getInformationAboutAFirewallRuleInAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.firewallRules.get( + "exampleresourcegroup", + "exampleserver", + "examplefirewallrule", + ); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutAFirewallRuleInAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesListByServerSample.ts new file mode 100644 index 000000000000..eb6633967c22 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/firewallRulesListByServerSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists information about all firewall rules in a server. + * + * @summary lists information about all firewall rules in a server. + * x-ms-original-file: 2026-01-01-preview/FirewallRulesListByServer.json + */ +async function listInformationAboutAllFirewallRulesInAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.firewallRules.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listInformationAboutAllFirewallRulesInAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCancelSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCancelSample.ts new file mode 100644 index 000000000000..b1b43dafb272 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCancelSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to cancels an active migration. + * + * @summary cancels an active migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCancel.json + */ +async function cancelAnActiveMigration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.cancel( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +async function main(): Promise { + await cancelAnActiveMigration(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCheckNameAvailabilitySample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..abccc250d18e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCheckNameAvailabilitySample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to checks if a proposed migration name is valid and available. + * + * @summary checks if a proposed migration name is valid and available. + * x-ms-original-file: 2026-01-01-preview/MigrationsCheckNameAvailability.json + */ +async function checkTheValidityAndAvailabilityOfTheGivenNameToAssignItToANewMigration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.checkNameAvailability( + "exampleresourcegroup", + "exampleserver", + { name: "examplemigration", type: "Microsoft.DBforPostgreSQL/flexibleServers/migrations" }, + ); + console.log(result); +} + +async function main(): Promise { + await checkTheValidityAndAvailabilityOfTheGivenNameToAssignItToANewMigration(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCreateSample.ts new file mode 100644 index 000000000000..13f452cae7f2 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsCreateSample.ts @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreate.json + */ +async function createAMigration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateOtherSourceTypesValidateMigrate.json + */ +async function createAMigrationWithOtherSourceTypeForValidatingAndMigrating(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + migrationOption: "ValidateAndMigrate", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: "examplesource:5432@exampleuser", + sourceType: "OnPremises", + sslMode: "Prefer", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateValidateOnly.json + */ +async function createAMigrationForValidatingOnly(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + migrationOption: "Validate", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithFullyQualifiedDomainName.json + */ +async function createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { sourceServerPassword: "xxxxxxxx", targetServerPassword: "xxxxxxxx" }, + }, + sourceDbServerFullyQualifiedDomainName: "examplesource.contoso.com", + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + targetDbServerFullyQualifiedDomainName: "exampletarget.contoso.com", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithOtherUsers.json + */ +async function createAMigrationSpecifyingUserNames(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationMode: "Offline", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + sourceServerUsername: "newadmin@examplesource", + targetServerUsername: "targetadmin", + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithPrivateEndpointServers.json + */ +async function createAMigrationWithPrivateEndpoint(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrationInstanceResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/examplesourcemigration", + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new migration. + * + * @summary creates a new migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsCreateWithRoles.json + */ +async function createAMigrationWithRoles(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.create( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { + location: "eastus", + dbsToMigrate: [ + "exampledatabase1", + "exampledatabase2", + "exampledatabase3", + "exampledatabase4", + ], + migrateRoles: "True", + migrationMode: "Offline", + overwriteDbsInTarget: "True", + secretParameters: { + adminCredentials: { + sourceServerPassword: "examplesourcepassword", + targetServerPassword: "exampletargetpassword", + }, + }, + sourceDbServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + }, + ); + console.log(result); +} + +async function main(): Promise { + await createAMigration(); + await createAMigrationWithOtherSourceTypeForValidatingAndMigrating(); + await createAMigrationForValidatingOnly(); + await createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers(); + await createAMigrationSpecifyingUserNames(); + await createAMigrationWithPrivateEndpoint(); + await createAMigrationWithRoles(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsGetSample.ts new file mode 100644 index 000000000000..fa5a583481c0 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsGetSample.ts @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGet.json + */ +async function getInformationAboutAMigration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithSuccessfulValidationAndMigration.json + */ +async function getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithSuccessfulValidationButMigrationFailure.json + */ +async function getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithSuccessfulValidationOnly.json + */ +async function getInformationAboutAMigrationWithSuccessfulValidationOnly(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a migration. + * + * @summary gets information about a migration. + * x-ms-original-file: 2026-01-01-preview/MigrationsGetMigrationWithValidationFailures.json + */ +async function getInformationAboutAMigrationWithValidationFailures(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.get( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + ); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutAMigration(); + await getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration(); + await getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration(); + await getInformationAboutAMigrationWithSuccessfulValidationOnly(); + await getInformationAboutAMigrationWithValidationFailures(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsListByTargetServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsListByTargetServerSample.ts new file mode 100644 index 000000000000..2ba38f875a60 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsListByTargetServerSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all migrations of a target flexible server. + * + * @summary lists all migrations of a target flexible server. + * x-ms-original-file: 2026-01-01-preview/MigrationsListByTargetServer.json + */ +async function listAllMigrationsOfATargetFlexibleServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.migrations.listByTargetServer( + "exampleresourcegroup", + "exampleserver", + { migrationListFilter: "All" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllMigrationsOfATargetFlexibleServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsUpdateSample.ts new file mode 100644 index 000000000000..c62914c13081 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/migrationsUpdateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. + * + * @summary updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. + * x-ms-original-file: 2026-01-01-preview/MigrationsUpdate.json + */ +async function updateAnExistingMigration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.migrations.update( + "exampleresourcegroup", + "exampleserver", + "examplemigration", + { setupLogicalReplicationOnSourceDbIfNeeded: "True" }, + ); + console.log(result); +} + +async function main(): Promise { + await updateAnExistingMigration(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/nameAvailabilityCheckGloballySample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/nameAvailabilityCheckGloballySample.ts similarity index 51% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/nameAvailabilityCheckGloballySample.ts rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/nameAvailabilityCheckGloballySample.ts index 47b27a49e946..8838c4c10841 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/nameAvailabilityCheckGloballySample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/nameAvailabilityCheckGloballySample.ts @@ -1,34 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - CheckNameAvailabilityRequest} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + * This sample demonstrates how to checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. * - * @summary Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckGlobally.json + * @summary checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + * x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckGlobally.json */ async function checkTheValidityAndAvailabilityOfTheGivenNameToAssignItToANewServerOrToUseItAsTheBaseNameOfANewPairOfVirtualEndpoints(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const parameters: CheckNameAvailabilityRequest = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.nameAvailability.checkGlobally({ name: "exampleserver", type: "Microsoft.DBforPostgreSQL/flexibleServers", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.nameAvailability.checkGlobally(parameters); + }); console.log(result); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/nameAvailabilityCheckWithLocationSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/nameAvailabilityCheckWithLocationSample.ts new file mode 100644 index 000000000000..4793c182c42f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/nameAvailabilityCheckWithLocationSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to check the availability of name for resource + * + * @summary check the availability of name for resource + * x-ms-original-file: 2026-01-01-preview/NameAvailabilityCheckWithLocation.json + */ +async function checkTheValidityAndAvailabilityOfTheGivenNameInTheGivenLocationToAssignItToANewServerOrToUseItAsTheBaseNameOfANewPairOfVirtualEndpoints(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.nameAvailability.checkWithLocation("eastus", { + name: "exampleserver", + type: "Microsoft.DBforPostgreSQL/flexibleServers", + }); + console.log(result); +} + +async function main(): Promise { + await checkTheValidityAndAvailabilityOfTheGivenNameInTheGivenLocationToAssignItToANewServerOrToUseItAsTheBaseNameOfANewPairOfVirtualEndpoints(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/operationsListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..2a59f174f143 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/operationsListSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all available REST API operations. + * + * @summary lists all available REST API operations. + * x-ms-original-file: 2026-01-01-preview/OperationsList.json + */ +async function listAllAvailableRestAPIOperations(): Promise { + const credential = new DefaultAzureCredential(); + const client = new PostgreSQLManagementFlexibleServerClient(credential); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllAvailableRestAPIOperations(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateDnsZoneSuffixGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateDnsZoneSuffixGetSample.ts similarity index 58% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateDnsZoneSuffixGetSample.ts rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateDnsZoneSuffixGetSample.ts index 612a3859c504..2b8a0d97f8c4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateDnsZoneSuffixGetSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateDnsZoneSuffixGetSample.ts @@ -3,15 +3,14 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the private DNS zone suffix. + * This sample demonstrates how to gets the private DNS zone suffix. * - * @summary Gets the private DNS zone suffix. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateDnsZoneSuffixGet.json + * @summary gets the private DNS zone suffix. + * x-ms-original-file: 2026-01-01-preview/PrivateDnsZoneSuffixGet.json */ -async function getThePrivateDnsSuffix(): Promise { +async function getThePrivateDNSSuffix(): Promise { const credential = new DefaultAzureCredential(); const client = new PostgreSQLManagementFlexibleServerClient(credential); const result = await client.privateDnsZoneSuffix.get(); @@ -19,7 +18,7 @@ async function getThePrivateDnsSuffix(): Promise { } async function main(): Promise { - await getThePrivateDnsSuffix(); + await getThePrivateDNSSuffix(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts new file mode 100644 index 000000000000..df3ee66e7aa8 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes a private endpoint connection. + * + * @summary deletes a private endpoint connection. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsDelete.json + */ +async function deleteAPrivateEndpointConnection(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.privateEndpointConnections.delete( + "exampleresourcegroup", + "exampleserver", + "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", + ); +} + +async function main(): Promise { + await deleteAPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsGetSample.ts new file mode 100644 index 000000000000..e9dad0136eb7 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets a private endpoint connection. + * + * @summary gets a private endpoint connection. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsGet.json + */ +async function getAPrivateEndpointConnection(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + "exampleresourcegroup", + "exampleserver", + "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", + ); + console.log(result); +} + +async function main(): Promise { + await getAPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsListByServerSample.ts new file mode 100644 index 000000000000..7c3462ecabc1 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsListByServerSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all private endpoint connections on a server. + * + * @summary lists all private endpoint connections on a server. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsList.json + */ +async function listAllPrivateEndpointConnectionsOnAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.privateEndpointConnections.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllPrivateEndpointConnectionsOnAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsUpdateSample.ts new file mode 100644 index 000000000000..a6179a127b6e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateEndpointConnectionsUpdateSample.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to approves or rejects a private endpoint connection. + * + * @summary approves or rejects a private endpoint connection. + * x-ms-original-file: 2026-01-01-preview/PrivateEndpointConnectionsUpdate.json + */ +async function approveOrRejectAPrivateEndpointConnection(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.update( + "exampleresourcegroup", + "exampleserver", + "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", + { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@contoso.com", + status: "Approved", + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await approveOrRejectAPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateLinkResourcesGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateLinkResourcesGetSample.ts new file mode 100644 index 000000000000..411a5fd829b4 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateLinkResourcesGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets a private link resource for PostgreSQL server. + * + * @summary gets a private link resource for PostgreSQL server. + * x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesGet.json + */ +async function getsAPrivateLinkResourceForPostgreSQL(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.privateLinkResources.get( + "exampleresourcegroup", + "exampleserver", + "exampleprivatelink", + ); + console.log(result); +} + +async function main(): Promise { + await getsAPrivateLinkResourceForPostgreSQL(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateLinkResourcesListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateLinkResourcesListByServerSample.ts new file mode 100644 index 000000000000..bca779ae5413 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/privateLinkResourcesListByServerSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the private link resources for PostgreSQL server. + * + * @summary gets the private link resources for PostgreSQL server. + * x-ms-original-file: 2026-01-01-preview/PrivateLinkResourcesList.json + */ +async function getsPrivateLinkResourcesForPostgreSQL(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.privateLinkResources.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await getsPrivateLinkResourcesForPostgreSQL(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/quotaUsagesListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/quotaUsagesListSample.ts new file mode 100644 index 000000000000..63e0141f3c5e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/quotaUsagesListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get quota usages at specified location in a given subscription. + * + * @summary get quota usages at specified location in a given subscription. + * x-ms-original-file: 2026-01-01-preview/QuotaUsagesForFlexibleServers.json + */ +async function listOfQuotaUsagesForServers(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.quotaUsages.list("eastus")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listOfQuotaUsagesForServers(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/replicasListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/replicasListByServerSample.ts new file mode 100644 index 000000000000..d45f577fed56 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/replicasListByServerSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all read replicas of a server. + * + * @summary lists all read replicas of a server. + * x-ms-original-file: 2026-01-01-preview/ReplicasListByServer.json + */ +async function listAllReadReplicasOfAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.replicas.listByServer("exampleresourcegroup", "exampleserver")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllReadReplicasOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serverThreatProtectionSettingsCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serverThreatProtectionSettingsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ff2354a13076 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serverThreatProtectionSettingsCreateOrUpdateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates or updates a server's Advanced Threat Protection settings. + * + * @summary creates or updates a server's Advanced Threat Protection settings. + * x-ms-original-file: 2026-01-01-preview/AdvancedThreatProtectionSettingsCreateOrUpdate.json + */ +async function updateTheAdvancedThreatProtectionSettingsOfAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.serverThreatProtectionSettings.createOrUpdate( + "exampleresourcegroup", + "exampleserver", + "Default", + { state: "Enabled" }, + ); + console.log(result); +} + +async function main(): Promise { + await updateTheAdvancedThreatProtectionSettingsOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversCreateOrUpdateSample.ts similarity index 55% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversCreateOrUpdateSample.ts rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversCreateOrUpdateSample.ts index f26990b65909..56bea0d208a5 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversCreateOrUpdateSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversCreateOrUpdateSample.ts @@ -1,374 +1,267 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { - Server} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersClusterCreate.json */ async function createANewElasticCluster(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", administratorLogin: "examplelogin", administratorLoginPassword: "examplepassword", backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" }, cluster: { clusterSize: 2, defaultDatabaseName: "clusterdb" }, createMode: "Create", highAvailability: { mode: "Disabled" }, - location: "eastus", network: { publicNetworkAccess: "Disabled" }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 256, tier: "P15" }, version: "16", - }; + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new server. + * + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateGeoRestoreWithDataEncryptionEnabled.json + */ +async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", + createMode: "GeoRestore", + dataEncryption: { + type: "AzureKeyVault", + geoBackupKeyURI: + "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", + geoBackupUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + primaryKeyURI: + "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + primaryUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + }, + pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), + sourceServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates a new server. + * + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json + */ +async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", + createMode: "GeoRestore", + dataEncryption: { + type: "AzureKeyVault", + geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", + geoBackupUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + primaryUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + }, + pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), + sourceServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json */ async function createANewServerInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", backup: { backupRetentionDays: 7, geoRedundantBackup: "Enabled" }, createMode: "Create", highAvailability: { mode: "ZoneRedundant" }, - location: "eastus", network: { publicNetworkAccess: "Enabled" }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, - tags: { inCustomerVnet: "false", inMicrosoftVnet: "true" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + tags: { InCustomerVnet: "false", InMicrosoftVnet: "true" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json */ async function createANewServerInYourOwnVirtualNetworkWithSameZoneHighAvailability(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", backup: { backupRetentionDays: 7, geoRedundantBackup: "Enabled" }, createMode: "Create", highAvailability: { mode: "SameZone" }, - location: "eastus", network: { delegatedSubnetResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", privateDnsZoneArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database", }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, - tags: { inCustomerVnet: "true", inMicrosoftVnet: "false" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new server. - * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReviveDropped.json - */ -async function createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "ReviveDropped", - location: "eastus", - pointInTimeUTC: new Date("2025-06-01T18:30:22.123456Z"), - sourceServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + tags: { InCustomerVnet: "true", InMicrosoftVnet: "false" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreatePointInTimeRestore.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreatePointInTimeRestore.json */ async function createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "PointInTimeRestore", + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { location: "eastus", + createMode: "PointInTimeRestore", pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), sourceServerResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateReplica.json */ -async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "GeoRestore", - dataEncryption: { - type: "AzureKeyVault", - geoBackupKeyURI: - "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", - geoBackupUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", - primaryUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", - }, +async function createAReadReplicaOfAnExistingServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { identity: { type: "UserAssigned", userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}, }, }, location: "eastus", - pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), - sourceServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new server. - * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabled.json - */ -async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "GeoRestore", + createMode: "Replica", dataEncryption: { type: "AzureKeyVault", - geoBackupKeyURI: - "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", - geoBackupUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + geoBackupKeyURI: "", + geoBackupUserAssignedIdentityId: "", primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), sourceServerResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateReviveDropped.json */ -async function createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - administratorLogin: "exampleadministratorlogin", - administratorLoginPassword: "examplepassword", - authConfig: { - activeDirectoryAuth: "Enabled", - passwordAuth: "Enabled", - tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", - }, - availabilityZone: "1", - backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" }, - createMode: "Create", - dataEncryption: { type: "SystemManaged" }, - highAvailability: { mode: "Disabled" }, - location: "eastus", - network: { - delegatedSubnetResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", - privateDnsZoneArmResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", - }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, - storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, - version: "17", - }; +async function createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(): Promise { const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", + createMode: "ReviveDropped", + pointInTimeUTC: new Date("2025-06-01T18:30:22.123456Z"), + sourceServerResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver", + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabledAutoUpdate.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateWithDataEncryptionEnabled.json */ -async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { +async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", @@ -379,56 +272,43 @@ async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAu geoBackupKeyURI: "", geoBackupUserAssignedIdentityId: "", primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, highAvailability: { mode: "ZoneRedundant" }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", network: { delegatedSubnetResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", privateDnsZoneArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabled.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateWithDataEncryptionEnabledAutoUpdate.json */ -async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { +async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + location: "eastus", administratorLogin: "exampleadministratorlogin", administratorLoginPassword: "examplepassword", availabilityZone: "1", @@ -438,104 +318,73 @@ async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey(): Pr type: "AzureKeyVault", geoBackupKeyURI: "", geoBackupUserAssignedIdentityId: "", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", primaryUserAssignedIdentityId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", }, highAvailability: { mode: "ZoneRedundant" }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - location: "eastus", network: { delegatedSubnetResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", privateDnsZoneArmResourceId: "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, - sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, version: "17", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); console.log(result); } /** - * This sample demonstrates how to Creates a new server. + * This sample demonstrates how to creates a new server. * - * @summary Creates a new server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReplica.json + * @summary creates a new server. + * x-ms-original-file: 2026-01-01-preview/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json */ -async function createAReadReplicaOfAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: Server = { - createMode: "Replica", - dataEncryption: { - type: "AzureKeyVault", - geoBackupKeyURI: "", - geoBackupUserAssignedIdentityId: "", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - primaryUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", +async function createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.createOrUpdate("exampleresourcegroup", "exampleserver", { + location: "eastus", + administratorLogin: "exampleadministratorlogin", + administratorLoginPassword: "examplepassword", + authConfig: { + activeDirectoryAuth: "Enabled", + passwordAuth: "Enabled", + tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, + availabilityZone: "1", + backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" }, + createMode: "Create", + dataEncryption: { type: "SystemManaged" }, + highAvailability: { mode: "Disabled" }, + network: { + delegatedSubnetResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", + privateDnsZoneArmResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, - location: "eastus", - pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"), - sourceServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); + storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" }, + version: "17", + sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" }, + }); console.log(result); } async function main(): Promise { await createANewElasticCluster(); + await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); + await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); await createANewServerInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability(); await createANewServerInYourOwnVirtualNetworkWithSameZoneHighAvailability(); - await createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(); await createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer(); - await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); - await createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); - await createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(); - await createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); - await createANewServerWithDataEncryptionBasedOnCustomerManagedKey(); await createAReadReplicaOfAnExistingServer(); + await createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(); + await createANewServerWithDataEncryptionBasedOnCustomerManagedKey(); + await createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); + await createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(); } main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversDeleteSample.ts new file mode 100644 index 000000000000..97b62f027471 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes or drops an existing server. + * + * @summary deletes or drops an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersDelete.json + */ +async function deleteOrDropAnExistingServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.delete("exampleresourcegroup", "exampleserver"); +} + +async function main(): Promise { + await deleteOrDropAnExistingServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversGetSample.ts new file mode 100644 index 000000000000..ae397b74818d --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversGetSample.ts @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about an existing server. + * + * @summary gets information about an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersGet.json + */ +async function getInformationAboutAnExistingServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.get("exampleresourcegroup", "exampleserver"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about an existing server. + * + * @summary gets information about an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersGetWithPrivateEndpoints.json + */ +async function getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.get("exampleresourcegroup", "exampleserver"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about an existing server. + * + * @summary gets information about an existing server. + * x-ms-original-file: 2026-01-01-preview/ServersGetWithVnet.json + */ +async function getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.get("exampleresourcegroup", "exampleserver"); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutAnExistingServer(); + await getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections(); + await getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversListByResourceGroupSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversListByResourceGroupSample.ts new file mode 100644 index 000000000000..606bc73be489 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all servers in a resource group. + * + * @summary lists all servers in a resource group. + * x-ms-original-file: 2026-01-01-preview/ServersListByResourceGroup.json + */ +async function listAllServersInAResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.servers.listByResourceGroup("exampleresourcegroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllServersInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversListBySubscriptionSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversListBySubscriptionSample.ts similarity index 55% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversListBySubscriptionSample.ts rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversListBySubscriptionSample.ts index 09682e1b35f7..8121b561380d 100644 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversListBySubscriptionSample.ts +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversListBySubscriptionSample.ts @@ -3,27 +3,22 @@ import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists all servers in a subscription. + * This sample demonstrates how to lists all servers in a subscription. * - * @summary Lists all servers in a subscription. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListBySubscription.json + * @summary lists all servers in a subscription. + * x-ms-original-file: 2026-01-01-preview/ServersListBySubscription.json */ async function listAllServersInASubscription(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.servers.listBySubscription()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversMigrateNetworkModeSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversMigrateNetworkModeSample.ts new file mode 100644 index 000000000000..f84bda8dea85 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversMigrateNetworkModeSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. + * + * @summary migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. + * x-ms-original-file: 2026-01-01-preview/ServersMigrateNetworkMode.json + */ +async function migrateServerNetworkConfiguration(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.migrateNetworkMode("exampleresourcegroup", "exampleserver"); + console.log(result); +} + +async function main(): Promise { + await migrateServerNetworkConfiguration(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversRestartSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversRestartSample.ts new file mode 100644 index 000000000000..76e07389867f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversRestartSample.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to restarts PostgreSQL database engine in a server. + * + * @summary restarts PostgreSQL database engine in a server. + * x-ms-original-file: 2026-01-01-preview/ServersRestart.json + */ +async function restartPostgreSQLDatabaseEngineInAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.restart("exampleresourcegroup", "exampleserver"); +} + +/** + * This sample demonstrates how to restarts PostgreSQL database engine in a server. + * + * @summary restarts PostgreSQL database engine in a server. + * x-ms-original-file: 2026-01-01-preview/ServersRestartWithFailover.json + */ +async function restartPostgreSQLDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.restart("exampleresourcegroup", "exampleserver", { + parameters: { failoverMode: "ForcedFailover", restartWithFailover: true }, + }); +} + +async function main(): Promise { + await restartPostgreSQLDatabaseEngineInAServer(); + await restartPostgreSQLDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversStartSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversStartSample.ts new file mode 100644 index 000000000000..3768a06f40cd --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversStartSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to starts a stopped server. + * + * @summary starts a stopped server. + * x-ms-original-file: 2026-01-01-preview/ServersStart.json + */ +async function startAStoppedServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.start("exampleresourcegroup", "exampleserver"); +} + +async function main(): Promise { + await startAStoppedServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversStopSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversStopSample.ts new file mode 100644 index 000000000000..09b4550b702f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversStopSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to stops a server. + * + * @summary stops a server. + * x-ms-original-file: 2026-01-01-preview/ServersStop.json + */ +async function stopAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.servers.stop("exampleresourcegroup", "exampleserver"); +} + +async function main(): Promise { + await stopAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversUpdateSample.ts new file mode 100644 index 000000000000..1e1079f998e3 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/serversUpdateSample.ts @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsForcedStandaloneServer.json + */ +async function promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Standalone", promoteOption: "Forced" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsForcedSwitchover.json + */ +async function switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Switchover", promoteOption: "Forced" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsPlannedStandaloneServer.json + */ +async function promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Standalone", promoteOption: "Planned" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersPromoteReplicaAsPlannedSwitchover.json + */ +async function switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + replica: { promoteMode: "Switchover", promoteOption: "Planned" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdate.json + */ +async function updateAnExistingServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + administratorLoginPassword: "examplenewpassword", + backup: { backupRetentionDays: 20 }, + createMode: "Update", + storage: { autoGrow: "Enabled", storageSizeGB: 1024, tier: "P30" }, + sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithCustomMaintenanceWindow.json + */ +async function updateAnExistingServerWithCustomMaintenanceWindow(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + createMode: "Update", + maintenanceWindow: { customWindow: "Enabled", dayOfWeek: 0, startHour: 8, startMinute: 0 }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithDataEncryptionEnabled.json + */ +async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + administratorLoginPassword: "examplenewpassword", + backup: { backupRetentionDays: 20 }, + createMode: "Update", + dataEncryption: { + type: "AzureKeyVault", + geoBackupKeyURI: + "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", + geoBackupUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + primaryKeyURI: + "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + primaryUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + }, + sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json + */ +async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": + {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": + {}, + }, + }, + administratorLoginPassword: "examplenewpassword", + backup: { backupRetentionDays: 20 }, + createMode: "Update", + dataEncryption: { + type: "AzureKeyVault", + geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", + geoBackupUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + primaryUserAssignedIdentityId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + }, + sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithMajorVersionUpgrade.json + */ +async function updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSQLDatabaseEngine(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + createMode: "Update", + version: "17", + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * + * @summary updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. + * x-ms-original-file: 2026-01-01-preview/ServersUpdateWithMicrosoftEntraEnabled.json + */ +async function updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.servers.update("exampleresourcegroup", "exampleserver", { + administratorLoginPassword: "examplenewpassword", + authConfig: { + activeDirectoryAuth: "Enabled", + passwordAuth: "Enabled", + tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", + }, + backup: { backupRetentionDays: 20 }, + createMode: "Update", + storage: { autoGrow: "Disabled", storageSizeGB: 1024, tier: "P30" }, + sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, + }); + console.log(result); +} + +async function main(): Promise { + await promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); + await switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(); + await promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); + await switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(); + await updateAnExistingServer(); + await updateAnExistingServerWithCustomMaintenanceWindow(); + await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); + await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); + await updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSQLDatabaseEngine(); + await updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsGetSample.ts new file mode 100644 index 000000000000..63b61f9d8e2f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the tuning options of a server. + * + * @summary gets the tuning options of a server. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsGet.json + */ +async function getTheTuningOptionsOfAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.tuningOptions.get("exampleresourcegroup", "exampleserver", "index"); + console.log(result); +} + +async function main(): Promise { + await getTheTuningOptionsOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsListByServerSample.ts new file mode 100644 index 000000000000..161ed480236e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsListByServerSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists the tuning options of a server. + * + * @summary lists the tuning options of a server. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListByServer.json + */ +async function listTheTuningOptionsOfAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listTheTuningOptionsOfAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsListRecommendationsSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsListRecommendationsSample.ts new file mode 100644 index 000000000000..53c7dd659a7f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/tuningOptionsListRecommendationsSample.ts @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists available object recommendations. + * + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListIndexRecommendations.json + */ +async function listAvailableIndexRecommendations(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "index", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists available object recommendations. + * + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json + */ +async function listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "index", + { recommendationType: "CreateIndex" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists available object recommendations. + * + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListTableRecommendations.json + */ +async function listAvailableTableRecommendations(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "table", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +/** + * This sample demonstrates how to lists available object recommendations. + * + * @summary lists available object recommendations. + * x-ms-original-file: 2026-01-01-preview/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json + */ +async function listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.tuningOptions.listRecommendations( + "exampleresourcegroup", + "exampleserver", + "table", + { recommendationType: "AnalyzeTable" }, + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAvailableIndexRecommendations(); + await listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(); + await listAvailableTableRecommendations(); + await listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsCreateSample.ts new file mode 100644 index 000000000000..7929e2cb3789 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsCreateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates a pair of virtual endpoints for a server. + * + * @summary creates a pair of virtual endpoints for a server. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointCreate.json + */ +async function createAPairOfVirtualEndpointsForAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.virtualEndpoints.create( + "exampleresourcegroup", + "exampleserver", + "examplebasename", + { endpointType: "ReadWrite", members: ["exampleprimaryserver"] }, + ); + console.log(result); +} + +async function main(): Promise { + await createAPairOfVirtualEndpointsForAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsDeleteSample.ts new file mode 100644 index 000000000000..acaabcbd4920 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes a pair of virtual endpoints. + * + * @summary deletes a pair of virtual endpoints. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointDelete.json + */ +async function deleteAPairOfVirtualEndpoints(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + await client.virtualEndpoints.delete("exampleresourcegroup", "exampleserver", "examplebasename"); +} + +async function main(): Promise { + await deleteAPairOfVirtualEndpoints(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsGetSample.ts new file mode 100644 index 000000000000..9038df718647 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a pair of virtual endpoints. + * + * @summary gets information about a pair of virtual endpoints. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointsGet.json + */ +async function getInformationAboutAPairOfVirtualEndpoints(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.virtualEndpoints.get( + "exampleresourcegroup", + "exampleserver", + "examplebasename", + ); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutAPairOfVirtualEndpoints(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsListByServerSample.ts new file mode 100644 index 000000000000..65d719b51f3e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsListByServerSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists pair of virtual endpoints associated to a server. + * + * @summary lists pair of virtual endpoints associated to a server. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointsListByServer.json + */ +async function listPairOfVirtualEndpointsAssociatedToAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.virtualEndpoints.listByServer( + "exampleresourcegroup", + "exampleserver", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listPairOfVirtualEndpointsAssociatedToAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsUpdateSample.ts new file mode 100644 index 000000000000..a44848a0575b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualEndpointsUpdateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates a pair of virtual endpoints for a server. + * + * @summary updates a pair of virtual endpoints for a server. + * x-ms-original-file: 2026-01-01-preview/VirtualEndpointUpdate.json + */ +async function updateAPairOfVirtualEndpointsForAServer(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.virtualEndpoints.update( + "exampleresourcegroup", + "exampleserver", + "examplebasename", + { endpointType: "ReadWrite", members: ["exampleprimaryserver"] }, + ); + console.log(result); +} + +async function main(): Promise { + await updateAPairOfVirtualEndpointsForAServer(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualNetworkSubnetUsageListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualNetworkSubnetUsageListSample.ts new file mode 100644 index 000000000000..3ceef8c6a6fb --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/src/virtualNetworkSubnetUsageListSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists the virtual network subnet usage for a given virtual network. + * + * @summary lists the virtual network subnet usage for a given virtual network. + * x-ms-original-file: 2026-01-01-preview/VirtualNetworkSubnetUsageList.json + */ +async function listTheVirtualNetworkSubnetUsageForAGivenVirtualNetwork(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); + const result = await client.virtualNetworkSubnetUsage.list("eastus", { + virtualNetworkArmResourceId: + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork", + }); + console.log(result); +} + +async function main(): Promise { + await listTheVirtualNetworkSubnetUsageForAGivenVirtualNetwork(); +} + +main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/tsconfig.json b/sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/tsconfig.json similarity index 100% rename from sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/tsconfig.json rename to sdk/postgresql/arm-postgresql-flexible/samples/v10-beta/typescript/tsconfig.json diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/README.md b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/README.md deleted file mode 100644 index fced622c8b38..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/README.md +++ /dev/null @@ -1,180 +0,0 @@ -# client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [administratorsMicrosoftEntraCreateOrUpdateSample.js][administratorsmicrosoftentracreateorupdatesample] | Creates a new server administrator associated to a Microsoft Entra principal. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraAdd.json | -| [administratorsMicrosoftEntraDeleteSample.js][administratorsmicrosoftentradeletesample] | Deletes an existing server administrator associated to a Microsoft Entra principal. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraDelete.json | -| [administratorsMicrosoftEntraGetSample.js][administratorsmicrosoftentragetsample] | Gets information about a server administrator associated to a Microsoft Entra principal. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraGet.json | -| [administratorsMicrosoftEntraListByServerSample.js][administratorsmicrosoftentralistbyserversample] | List all server administrators associated to a Microsoft Entra principal. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraListByServer.json | -| [advancedThreatProtectionSettingsGetSample.js][advancedthreatprotectionsettingsgetsample] | Gets state of advanced threat protection settings for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsGet.json | -| [advancedThreatProtectionSettingsListByServerSample.js][advancedthreatprotectionsettingslistbyserversample] | Lists state of advanced threat protection settings for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsListByServer.json | -| [backupsAutomaticAndOnDemandCreateSample.js][backupsautomaticandondemandcreatesample] | Creates an on demand backup of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandCreate.json | -| [backupsAutomaticAndOnDemandDeleteSample.js][backupsautomaticandondemanddeletesample] | Deletes a specific backup, given its name. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandDelete.json | -| [backupsAutomaticAndOnDemandGetSample.js][backupsautomaticandondemandgetsample] | Gets information of an on demand backup, given its name. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandGet.json | -| [backupsAutomaticAndOnDemandListByServerSample.js][backupsautomaticandondemandlistbyserversample] | Lists all available backups of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandListByServer.json | -| [backupsLongTermRetentionCheckPrerequisitesSample.js][backupslongtermretentioncheckprerequisitessample] | Performs all checks required for a long term retention backup operation to succeed. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionCheckPrerequisites.json | -| [backupsLongTermRetentionGetSample.js][backupslongtermretentiongetsample] | Gets the results of a long retention backup operation for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionGet.json | -| [backupsLongTermRetentionListByServerSample.js][backupslongtermretentionlistbyserversample] | Lists the results of the long term retention backup operations for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionListByServer.json | -| [backupsLongTermRetentionStartSample.js][backupslongtermretentionstartsample] | Initiates a long term retention backup. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionStart.json | -| [capabilitiesByLocationListSample.js][capabilitiesbylocationlistsample] | Lists the capabilities available in a given location for a specific subscription. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByLocationList.json | -| [capabilitiesByServerListSample.js][capabilitiesbyserverlistsample] | Lists the capabilities available for a given server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByServerList.json | -| [capturedLogsListByServerSample.js][capturedlogslistbyserversample] | Lists all captured logs for download in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapturedLogsListByServer.json | -| [configurationsGetSample.js][configurationsgetsample] | Gets information about a specific configuration (also known as server parameter) of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsGet.json | -| [configurationsListByServerSample.js][configurationslistbyserversample] | Lists all configurations (also known as server parameters) of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsListByServer.json | -| [configurationsPutSample.js][configurationsputsample] | Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdateUsingPut.json | -| [configurationsUpdateSample.js][configurationsupdatesample] | Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdate.json | -| [databasesCreateSample.js][databasescreatesample] | Creates a new database. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesCreate.json | -| [databasesDeleteSample.js][databasesdeletesample] | Deletes an existing database. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesDelete.json | -| [databasesGetSample.js][databasesgetsample] | Gets information about an existing database. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesGet.json | -| [databasesListByServerSample.js][databaseslistbyserversample] | Lists all databases in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesListByServer.json | -| [firewallRulesCreateOrUpdateSample.js][firewallrulescreateorupdatesample] | Creates a new firewall rule or updates an existing firewall rule. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesCreateOrUpdate.json | -| [firewallRulesDeleteSample.js][firewallrulesdeletesample] | Deletes an existing firewall rule. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesDelete.json | -| [firewallRulesGetSample.js][firewallrulesgetsample] | Gets information about a firewall rule in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesGet.json | -| [firewallRulesListByServerSample.js][firewallruleslistbyserversample] | Lists information about all firewall rules in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesListByServer.json | -| [migrationsCancelSample.js][migrationscancelsample] | Cancels an active migration. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCancel.json | -| [migrationsCheckNameAvailabilitySample.js][migrationschecknameavailabilitysample] | Checks if a proposed migration name is valid and available. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCheckNameAvailability.json | -| [migrationsCreateSample.js][migrationscreatesample] | Creates a new migration. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateValidateOnly.json | -| [migrationsGetSample.js][migrationsgetsample] | Gets information about a migration. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationAndMigration.json | -| [migrationsListByTargetServerSample.js][migrationslistbytargetserversample] | Lists all migrations of a target flexible server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsListByTargetServer.json | -| [migrationsUpdateSample.js][migrationsupdatesample] | Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsUpdate.json | -| [nameAvailabilityCheckGloballySample.js][nameavailabilitycheckgloballysample] | Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckGlobally.json | -| [nameAvailabilityCheckWithLocationSample.js][nameavailabilitycheckwithlocationsample] | Check the availability of name for resource x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckWithLocation.json | -| [operationsListSample.js][operationslistsample] | Lists all available REST API operations. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/OperationsList.json | -| [privateDnsZoneSuffixGetSample.js][privatednszonesuffixgetsample] | Gets the private DNS zone suffix. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateDnsZoneSuffixGet.json | -| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | Deletes a private endpoint connection. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsDelete.json | -| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | Gets a private endpoint connection. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsGet.json | -| [privateEndpointConnectionsListByServerSample.js][privateendpointconnectionslistbyserversample] | Lists all private endpoint connections on a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsList.json | -| [privateEndpointConnectionsUpdateSample.js][privateendpointconnectionsupdatesample] | Approves or rejects a private endpoint connection. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsUpdate.json | -| [privateLinkResourcesGetSample.js][privatelinkresourcesgetsample] | Gets a private link resource for PostgreSQL server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesGet.json | -| [privateLinkResourcesListByServerSample.js][privatelinkresourceslistbyserversample] | Gets the private link resources for PostgreSQL server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesList.json | -| [quotaUsagesListSample.js][quotausageslistsample] | Get quota usages at specified location in a given subscription. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/QuotaUsagesForFlexibleServers.json | -| [replicasListByServerSample.js][replicaslistbyserversample] | Lists all read replicas of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ReplicasListByServer.json | -| [serverThreatProtectionSettingsCreateOrUpdateSample.js][serverthreatprotectionsettingscreateorupdatesample] | Creates or updates a server's Advanced Threat Protection settings. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsCreateOrUpdate.json | -| [serversCreateOrUpdateSample.js][serverscreateorupdatesample] | Creates a new server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json | -| [serversDeleteSample.js][serversdeletesample] | Deletes or drops an existing server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersDelete.json | -| [serversGetSample.js][serversgetsample] | Gets information about an existing server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithVnet.json | -| [serversListByResourceGroupSample.js][serverslistbyresourcegroupsample] | Lists all servers in a resource group. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListByResourceGroup.json | -| [serversListBySubscriptionSample.js][serverslistbysubscriptionsample] | Lists all servers in a subscription. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListBySubscription.json | -| [serversRestartSample.js][serversrestartsample] | Restarts PostgreSQL database engine in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestartWithFailover.json | -| [serversStartSample.js][serversstartsample] | Starts a stopped server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStart.json | -| [serversStopSample.js][serversstopsample] | Stops a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStop.json | -| [serversUpdateSample.js][serversupdatesample] | Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json | -| [tuningOptionsGetSample.js][tuningoptionsgetsample] | Gets the tuning options of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsGet.json | -| [tuningOptionsListByServerSample.js][tuningoptionslistbyserversample] | Lists the tuning options of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListByServer.json | -| [tuningOptionsListRecommendationsSample.js][tuningoptionslistrecommendationssample] | Lists available object recommendations. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json | -| [virtualEndpointsCreateSample.js][virtualendpointscreatesample] | Creates a pair of virtual endpoints for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointCreate.json | -| [virtualEndpointsDeleteSample.js][virtualendpointsdeletesample] | Deletes a pair of virtual endpoints. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointDelete.json | -| [virtualEndpointsGetSample.js][virtualendpointsgetsample] | Gets information about a pair of virtual endpoints. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsGet.json | -| [virtualEndpointsListByServerSample.js][virtualendpointslistbyserversample] | Lists pair of virtual endpoints associated to a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsListByServer.json | -| [virtualEndpointsUpdateSample.js][virtualendpointsupdatesample] | Updates a pair of virtual endpoints for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointUpdate.json | -| [virtualNetworkSubnetUsageListSample.js][virtualnetworksubnetusagelistsample] | Lists the virtual network subnet usage for a given virtual network. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualNetworkSubnetUsageList.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 administratorsMicrosoftEntraCreateOrUpdateSample.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 -cross-env POSTGRESQL_SUBSCRIPTION_ID="" POSTGRESQL_RESOURCE_GROUP="" node administratorsMicrosoftEntraCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[administratorsmicrosoftentracreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraCreateOrUpdateSample.js -[administratorsmicrosoftentradeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraDeleteSample.js -[administratorsmicrosoftentragetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraGetSample.js -[administratorsmicrosoftentralistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraListByServerSample.js -[advancedthreatprotectionsettingsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/advancedThreatProtectionSettingsGetSample.js -[advancedthreatprotectionsettingslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/advancedThreatProtectionSettingsListByServerSample.js -[backupsautomaticandondemandcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandCreateSample.js -[backupsautomaticandondemanddeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandDeleteSample.js -[backupsautomaticandondemandgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandGetSample.js -[backupsautomaticandondemandlistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandListByServerSample.js -[backupslongtermretentioncheckprerequisitessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionCheckPrerequisitesSample.js -[backupslongtermretentiongetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionGetSample.js -[backupslongtermretentionlistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionListByServerSample.js -[backupslongtermretentionstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionStartSample.js -[capabilitiesbylocationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capabilitiesByLocationListSample.js -[capabilitiesbyserverlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capabilitiesByServerListSample.js -[capturedlogslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/capturedLogsListByServerSample.js -[configurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsGetSample.js -[configurationslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsListByServerSample.js -[configurationsputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsPutSample.js -[configurationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/configurationsUpdateSample.js -[databasescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesCreateSample.js -[databasesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesDeleteSample.js -[databasesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesGetSample.js -[databaseslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesListByServerSample.js -[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesCreateOrUpdateSample.js -[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesDeleteSample.js -[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesGetSample.js -[firewallruleslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesListByServerSample.js -[migrationscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCancelSample.js -[migrationschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCheckNameAvailabilitySample.js -[migrationscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCreateSample.js -[migrationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsGetSample.js -[migrationslistbytargetserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsListByTargetServerSample.js -[migrationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsUpdateSample.js -[nameavailabilitycheckgloballysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/nameAvailabilityCheckGloballySample.js -[nameavailabilitycheckwithlocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/nameAvailabilityCheckWithLocationSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/operationsListSample.js -[privatednszonesuffixgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateDnsZoneSuffixGetSample.js -[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsDeleteSample.js -[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsGetSample.js -[privateendpointconnectionslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsListByServerSample.js -[privateendpointconnectionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsUpdateSample.js -[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateLinkResourcesGetSample.js -[privatelinkresourceslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateLinkResourcesListByServerSample.js -[quotausageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/quotaUsagesListSample.js -[replicaslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/replicasListByServerSample.js -[serverthreatprotectionsettingscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serverThreatProtectionSettingsCreateOrUpdateSample.js -[serverscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversCreateOrUpdateSample.js -[serversdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversDeleteSample.js -[serversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversGetSample.js -[serverslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversListByResourceGroupSample.js -[serverslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversListBySubscriptionSample.js -[serversrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversRestartSample.js -[serversstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversStartSample.js -[serversstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversStopSample.js -[serversupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversUpdateSample.js -[tuningoptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsGetSample.js -[tuningoptionslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsListByServerSample.js -[tuningoptionslistrecommendationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsListRecommendationsSample.js -[virtualendpointscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsCreateSample.js -[virtualendpointsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsDeleteSample.js -[virtualendpointsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsGetSample.js -[virtualendpointslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsListByServerSample.js -[virtualendpointsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsUpdateSample.js -[virtualnetworksubnetusagelistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualNetworkSubnetUsageListSample.js -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-postgresql-flexible?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible/README.md diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraCreateOrUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraCreateOrUpdateSample.js deleted file mode 100644 index ce8f69e6a369..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraCreateOrUpdateSample.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Creates a new server administrator associated to a Microsoft Entra principal. - * - * @summary Creates a new server administrator associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraAdd.json - */ -async function addAServerAdministratorAssociatedToAMicrosoftEntraPrincipal() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; - const parameters = { - principalName: "exampleuser@contoso.com", - principalType: "User", - tenantId: "tttttttt-tttt-tttt-tttt-tttttttttttt", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.administratorsMicrosoftEntra.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - objectId, - parameters, - ); - console.log(result); -} - -async function main() { - await addAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraDeleteSample.js deleted file mode 100644 index ebd1ec6f2acc..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/administratorsMicrosoftEntraDeleteSample.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Deletes an existing server administrator associated to a Microsoft Entra principal. - * - * @summary Deletes an existing server administrator associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraDelete.json - */ -async function deleteAServerAdministratorAssociatedToAMicrosoftEntraPrincipal() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.administratorsMicrosoftEntra.beginDeleteAndWait( - resourceGroupName, - serverName, - objectId, - ); - console.log(result); -} - -async function main() { - await deleteAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandCreateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandCreateSample.js deleted file mode 100644 index d0a0d349b3d6..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandCreateSample.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Creates an on demand backup of a server. - * - * @summary Creates an on demand backup of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandCreate.json - */ -async function createAnOnDemandBackupOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "ondemandbackup-20250601T183022"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.backupsAutomaticAndOnDemand.beginCreateAndWait( - resourceGroupName, - serverName, - backupName, - ); - console.log(result); -} - -async function main() { - await createAnOnDemandBackupOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandDeleteSample.js deleted file mode 100644 index 8bcf09e80990..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsAutomaticAndOnDemandDeleteSample.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Deletes a specific backup, given its name. - * - * @summary Deletes a specific backup, given its name. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandDelete.json - */ -async function deleteAnOnDemandBackupGivenItsName() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "ondemandbackup-20250601T183022"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.backupsAutomaticAndOnDemand.beginDeleteAndWait( - resourceGroupName, - serverName, - backupName, - ); - console.log(result); -} - -async function main() { - await deleteAnOnDemandBackupGivenItsName(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionStartSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionStartSample.js deleted file mode 100644 index 25bd24787fb6..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/backupsLongTermRetentionStartSample.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Initiates a long term retention backup. - * - * @summary Initiates a long term retention backup. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionStart.json - */ -async function initiateALongTermRetentionBackup() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - backupSettings: { backupName: "exampleltrbackup" }, - targetDetails: { sasUriList: ["sasuri"] }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.backupsLongTermRetention.beginStartAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -async function main() { - await initiateALongTermRetentionBackup(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesCreateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesCreateSample.js deleted file mode 100644 index 74af772c9bc4..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesCreateSample.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Creates a new database. - * - * @summary Creates a new database. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesCreate.json - */ -async function createADatabase() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const databaseName = "exampledatabase"; - const parameters = { charset: "utf8", collation: "en_US.utf8" }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.databases.beginCreateAndWait( - resourceGroupName, - serverName, - databaseName, - parameters, - ); - console.log(result); -} - -async function main() { - await createADatabase(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesDeleteSample.js deleted file mode 100644 index 2846dc572e1d..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesDeleteSample.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Deletes an existing database. - * - * @summary Deletes an existing database. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesDelete.json - */ -async function deleteAnExistingDatabase() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const databaseName = "exampledatabase"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.databases.beginDeleteAndWait( - resourceGroupName, - serverName, - databaseName, - ); - console.log(result); -} - -async function main() { - await deleteAnExistingDatabase(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesGetSample.js deleted file mode 100644 index 77cb6c2d17e6..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/databasesGetSample.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Gets information about an existing database. - * - * @summary Gets information about an existing database. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesGet.json - */ -async function getInformationAboutAnExistingDatabase() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const databaseName = "exampledatabase"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.databases.get(resourceGroupName, serverName, databaseName); - console.log(result); -} - -async function main() { - await getInformationAboutAnExistingDatabase(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesCreateOrUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesCreateOrUpdateSample.js deleted file mode 100644 index 262a02a4831b..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesCreateOrUpdateSample.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Creates a new firewall rule or updates an existing firewall rule. - * - * @summary Creates a new firewall rule or updates an existing firewall rule. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesCreateOrUpdate.json - */ -async function createANewFirewallRuleOrUpdateAnExistingFirewallRule() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const firewallRuleName = "examplefirewallrule"; - const parameters = { - endIpAddress: "255.255.255.255", - startIpAddress: "0.0.0.0", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.firewallRules.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - firewallRuleName, - parameters, - ); - console.log(result); -} - -async function main() { - await createANewFirewallRuleOrUpdateAnExistingFirewallRule(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesDeleteSample.js deleted file mode 100644 index 5de4cc3d605f..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesDeleteSample.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Deletes an existing firewall rule. - * - * @summary Deletes an existing firewall rule. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesDelete.json - */ -async function deleteAnExistingFirewallRule() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const firewallRuleName = "examplefirewallrule"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.firewallRules.beginDeleteAndWait( - resourceGroupName, - serverName, - firewallRuleName, - ); - console.log(result); -} - -async function main() { - await deleteAnExistingFirewallRule(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesGetSample.js deleted file mode 100644 index 276c0f11ddad..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/firewallRulesGetSample.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Gets information about a firewall rule in a server. - * - * @summary Gets information about a firewall rule in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesGet.json - */ -async function getInformationAboutAFirewallRuleInAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const firewallRuleName = "examplefirewallrule"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.firewallRules.get(resourceGroupName, serverName, firewallRuleName); - console.log(result); -} - -async function main() { - await getInformationAboutAFirewallRuleInAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCancelSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCancelSample.js deleted file mode 100644 index feadcf6b44d6..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCancelSample.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Cancels an active migration. - * - * @summary Cancels an active migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCancel.json - */ -async function cancelAnActiveMigration() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.cancel(resourceGroupName, serverName, migrationName); - console.log(result); -} - -async function main() { - await cancelAnActiveMigration(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCreateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCreateSample.js deleted file mode 100644 index afd7e752e97c..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsCreateSample.js +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateValidateOnly.json - */ -async function createAMigrationForValidatingOnly() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters = { - dbsToMigrate: ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], - location: "eastus", - migrationMode: "Offline", - migrationOption: "Validate", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithOtherUsers.json - */ -async function createAMigrationSpecifyingUserNames() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters = { - dbsToMigrate: ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], - location: "eastus", - migrationMode: "Offline", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - sourceServerUsername: "newadmin@examplesource", - targetServerUsername: "targetadmin", - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithFullyQualifiedDomainName.json - */ -async function createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters = { - dbsToMigrate: ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], - location: "eastus", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "xxxxxxxx", - targetServerPassword: "xxxxxxxx", - }, - }, - sourceDbServerFullyQualifiedDomainName: "examplesource.contoso.com", - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - targetDbServerFullyQualifiedDomainName: "exampletarget.contoso.com", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateOtherSourceTypesValidateMigrate.json - */ -async function createAMigrationWithOtherSourceTypeForValidatingAndMigrating() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters = { - dbsToMigrate: ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], - location: "eastus", - migrationMode: "Offline", - migrationOption: "ValidateAndMigrate", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: "examplesource:5432@exampleuser", - sourceType: "OnPremises", - sslMode: "Prefer", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithPrivateEndpointServers.json - */ -async function createAMigrationWithPrivateEndpoint() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters = { - dbsToMigrate: ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], - location: "eastus", - migrationInstanceResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/examplesourcemigration", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithRoles.json - */ -async function createAMigrationWithRoles() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters = { - dbsToMigrate: ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], - location: "eastus", - migrateRoles: "True", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreate.json - */ -async function createAMigration() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters = { - dbsToMigrate: ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], - location: "eastus", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -async function main() { - await createAMigrationForValidatingOnly(); - await createAMigrationSpecifyingUserNames(); - await createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers(); - await createAMigrationWithOtherSourceTypeForValidatingAndMigrating(); - await createAMigrationWithPrivateEndpoint(); - await createAMigrationWithRoles(); - await createAMigration(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsGetSample.js deleted file mode 100644 index 246d91375409..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/migrationsGetSample.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationAndMigration.json - */ -async function getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.get(resourceGroupName, serverName, migrationName); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationButMigrationFailure.json - */ -async function getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.get(resourceGroupName, serverName, migrationName); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationOnly.json - */ -async function getInformationAboutAMigrationWithSuccessfulValidationOnly() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.get(resourceGroupName, serverName, migrationName); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithValidationFailures.json - */ -async function getInformationAboutAMigrationWithValidationFailures() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.get(resourceGroupName, serverName, migrationName); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGet.json - */ -async function getInformationAboutAMigration() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.migrations.get(resourceGroupName, serverName, migrationName); - console.log(result); -} - -async function main() { - await getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration(); - await getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration(); - await getInformationAboutAMigrationWithSuccessfulValidationOnly(); - await getInformationAboutAMigrationWithValidationFailures(); - await getInformationAboutAMigration(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsDeleteSample.js deleted file mode 100644 index 321424069291..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsDeleteSample.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Deletes a private endpoint connection. - * - * @summary Deletes a private endpoint connection. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsDelete.json - */ -async function deleteAPrivateEndpointConnection() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const privateEndpointConnectionName = - "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginDeleteAndWait( - resourceGroupName, - serverName, - privateEndpointConnectionName, - ); - console.log(result); -} - -async function main() { - await deleteAPrivateEndpointConnection(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsUpdateSample.js deleted file mode 100644 index 4ee94b5aee2f..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateEndpointConnectionsUpdateSample.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Approves or rejects a private endpoint connection. - * - * @summary Approves or rejects a private endpoint connection. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsUpdate.json - */ -async function approveOrRejectAPrivateEndpointConnection() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const privateEndpointConnectionName = - "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e"; - const parameters = { - privateLinkServiceConnectionState: { - description: "Approved by johndoe@contoso.com", - status: "Approved", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginUpdateAndWait( - resourceGroupName, - serverName, - privateEndpointConnectionName, - parameters, - ); - console.log(result); -} - -async function main() { - await approveOrRejectAPrivateEndpointConnection(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateLinkResourcesGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateLinkResourcesGetSample.js deleted file mode 100644 index a6755e793559..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateLinkResourcesGetSample.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Gets a private link resource for PostgreSQL server. - * - * @summary Gets a private link resource for PostgreSQL server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesGet.json - */ -async function getsAPrivateLinkResourceForPostgreSql() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const groupName = "exampleprivatelink"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.privateLinkResources.get(resourceGroupName, serverName, groupName); - console.log(result); -} - -async function main() { - await getsAPrivateLinkResourceForPostgreSql(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateLinkResourcesListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateLinkResourcesListByServerSample.js deleted file mode 100644 index a30a6a64a638..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/privateLinkResourcesListByServerSample.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Gets the private link resources for PostgreSQL server. - * - * @summary Gets the private link resources for PostgreSQL server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesList.json - */ -async function getsPrivateLinkResourcesForPostgreSql() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.privateLinkResources.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - await getsPrivateLinkResourcesForPostgreSql(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serverThreatProtectionSettingsCreateOrUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serverThreatProtectionSettingsCreateOrUpdateSample.js deleted file mode 100644 index eb635c9e43f6..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serverThreatProtectionSettingsCreateOrUpdateSample.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Creates or updates a server's Advanced Threat Protection settings. - * - * @summary Creates or updates a server's Advanced Threat Protection settings. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsCreateOrUpdate.json - */ -async function updateTheAdvancedThreatProtectionSettingsOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const threatProtectionName = "Default"; - const parameters = { - state: "Enabled", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.serverThreatProtectionSettings.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - threatProtectionName, - parameters, - ); - console.log(result); -} - -async function main() { - await updateTheAdvancedThreatProtectionSettingsOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversDeleteSample.js deleted file mode 100644 index ae8376288c86..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversDeleteSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Deletes or drops an existing server. - * - * @summary Deletes or drops an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersDelete.json - */ -async function deleteOrDropAnExistingServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginDeleteAndWait(resourceGroupName, serverName); - console.log(result); -} - -async function main() { - await deleteOrDropAnExistingServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversGetSample.js deleted file mode 100644 index 2b42a9fc05e8..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversGetSample.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Gets information about an existing server. - * - * @summary Gets information about an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithVnet.json - */ -async function getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.get(resourceGroupName, serverName); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about an existing server. - * - * @summary Gets information about an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithPrivateEndpoints.json - */ -async function getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.get(resourceGroupName, serverName); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about an existing server. - * - * @summary Gets information about an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGet.json - */ -async function getInformationAboutAnExistingServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.get(resourceGroupName, serverName); - console.log(result); -} - -async function main() { - await getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(); - await getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections(); - await getInformationAboutAnExistingServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversRestartSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversRestartSample.js deleted file mode 100644 index 0aab5e582702..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversRestartSample.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Restarts PostgreSQL database engine in a server. - * - * @summary Restarts PostgreSQL database engine in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestartWithFailover.json - */ -async function restartPostgreSqlDatabaseEngineInAServerWithAForcedFailoverToStandbyServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters = { - failoverMode: "ForcedFailover", - restartWithFailover: true, - }; - const options = { parameters }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginRestartAndWait(resourceGroupName, serverName, options); - console.log(result); -} - -/** - * This sample demonstrates how to Restarts PostgreSQL database engine in a server. - * - * @summary Restarts PostgreSQL database engine in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestart.json - */ -async function restartPostgreSqlDatabaseEngineInAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginRestartAndWait(resourceGroupName, serverName); - console.log(result); -} - -async function main() { - await restartPostgreSqlDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(); - await restartPostgreSqlDatabaseEngineInAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversStartSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversStartSample.js deleted file mode 100644 index f728cceaea71..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversStartSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Starts a stopped server. - * - * @summary Starts a stopped server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStart.json - */ -async function startAStoppedServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginStartAndWait(resourceGroupName, serverName); - console.log(result); -} - -async function main() { - await startAStoppedServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversStopSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversStopSample.js deleted file mode 100644 index 9fad95a976b9..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/serversStopSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Stops a server. - * - * @summary Stops a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStop.json - */ -async function stopAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.servers.beginStopAndWait(resourceGroupName, serverName); - console.log(result); -} - -async function main() { - await stopAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsGetSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsGetSample.js deleted file mode 100644 index c0d2b5bcc441..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsGetSample.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Gets the tuning options of a server. - * - * @summary Gets the tuning options of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsGet.json - */ -async function getTheTuningOptionsOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "index"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.tuningOptionsOperations.get( - resourceGroupName, - serverName, - tuningOption, - ); - console.log(result); -} - -async function main() { - await getTheTuningOptionsOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsListByServerSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsListByServerSample.js deleted file mode 100644 index afb27ac1e760..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsListByServerSample.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Lists the tuning options of a server. - * - * @summary Lists the tuning options of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListByServer.json - */ -async function listTheTuningOptionsOfAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - await listTheTuningOptionsOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsListRecommendationsSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsListRecommendationsSample.js deleted file mode 100644 index 8d08081686d1..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/tuningOptionsListRecommendationsSample.js +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Lists available object recommendations. - * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json - */ -async function listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "index"; - const recommendationType = "CreateIndex"; - const options = { - recommendationType, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - options, - )) { - resArray.push(item); - } - console.log(resArray); -} - -/** - * This sample demonstrates how to Lists available object recommendations. - * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendations.json - */ -async function listAvailableIndexRecommendations() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "index"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - )) { - resArray.push(item); - } - console.log(resArray); -} - -/** - * This sample demonstrates how to Lists available object recommendations. - * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json - */ -async function listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "table"; - const recommendationType = "AnalyzeTable"; - const options = { - recommendationType, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - options, - )) { - resArray.push(item); - } - console.log(resArray); -} - -/** - * This sample demonstrates how to Lists available object recommendations. - * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendations.json - */ -async function listAvailableTableRecommendations() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "table"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - await listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(); - await listAvailableIndexRecommendations(); - await listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(); - await listAvailableTableRecommendations(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsCreateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsCreateSample.js deleted file mode 100644 index e6adf5bd756a..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsCreateSample.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Creates a pair of virtual endpoints for a server. - * - * @summary Creates a pair of virtual endpoints for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointCreate.json - */ -async function createAPairOfVirtualEndpointsForAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; - const parameters = { - endpointType: "ReadWrite", - members: ["exampleprimaryserver"], - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.virtualEndpoints.beginCreateAndWait( - resourceGroupName, - serverName, - virtualEndpointName, - parameters, - ); - console.log(result); -} - -async function main() { - await createAPairOfVirtualEndpointsForAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsDeleteSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsDeleteSample.js deleted file mode 100644 index db4b9d0015ac..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsDeleteSample.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Deletes a pair of virtual endpoints. - * - * @summary Deletes a pair of virtual endpoints. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointDelete.json - */ -async function deleteAPairOfVirtualEndpoints() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.virtualEndpoints.beginDeleteAndWait( - resourceGroupName, - serverName, - virtualEndpointName, - ); - console.log(result); -} - -async function main() { - await deleteAPairOfVirtualEndpoints(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsUpdateSample.js b/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsUpdateSample.js deleted file mode 100644 index 5e4f587a9545..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/javascript/virtualEndpointsUpdateSample.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv/config"); - -/** - * This sample demonstrates how to Updates a pair of virtual endpoints for a server. - * - * @summary Updates a pair of virtual endpoints for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointUpdate.json - */ -async function updateAPairOfVirtualEndpointsForAServer() { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; - const parameters = { - endpointType: "ReadWrite", - members: ["exampleprimaryserver"], - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); - const result = await client.virtualEndpoints.beginUpdateAndWait( - resourceGroupName, - serverName, - virtualEndpointName, - parameters, - ); - console.log(result); -} - -async function main() { - await updateAPairOfVirtualEndpointsForAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/README.md b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/README.md deleted file mode 100644 index b57bdb8cc32c..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [administratorsMicrosoftEntraCreateOrUpdateSample.ts][administratorsmicrosoftentracreateorupdatesample] | Creates a new server administrator associated to a Microsoft Entra principal. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraAdd.json | -| [administratorsMicrosoftEntraDeleteSample.ts][administratorsmicrosoftentradeletesample] | Deletes an existing server administrator associated to a Microsoft Entra principal. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraDelete.json | -| [administratorsMicrosoftEntraGetSample.ts][administratorsmicrosoftentragetsample] | Gets information about a server administrator associated to a Microsoft Entra principal. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraGet.json | -| [administratorsMicrosoftEntraListByServerSample.ts][administratorsmicrosoftentralistbyserversample] | List all server administrators associated to a Microsoft Entra principal. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraListByServer.json | -| [advancedThreatProtectionSettingsGetSample.ts][advancedthreatprotectionsettingsgetsample] | Gets state of advanced threat protection settings for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsGet.json | -| [advancedThreatProtectionSettingsListByServerSample.ts][advancedthreatprotectionsettingslistbyserversample] | Lists state of advanced threat protection settings for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsListByServer.json | -| [backupsAutomaticAndOnDemandCreateSample.ts][backupsautomaticandondemandcreatesample] | Creates an on demand backup of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandCreate.json | -| [backupsAutomaticAndOnDemandDeleteSample.ts][backupsautomaticandondemanddeletesample] | Deletes a specific backup, given its name. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandDelete.json | -| [backupsAutomaticAndOnDemandGetSample.ts][backupsautomaticandondemandgetsample] | Gets information of an on demand backup, given its name. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandGet.json | -| [backupsAutomaticAndOnDemandListByServerSample.ts][backupsautomaticandondemandlistbyserversample] | Lists all available backups of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandListByServer.json | -| [backupsLongTermRetentionCheckPrerequisitesSample.ts][backupslongtermretentioncheckprerequisitessample] | Performs all checks required for a long term retention backup operation to succeed. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionCheckPrerequisites.json | -| [backupsLongTermRetentionGetSample.ts][backupslongtermretentiongetsample] | Gets the results of a long retention backup operation for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionGet.json | -| [backupsLongTermRetentionListByServerSample.ts][backupslongtermretentionlistbyserversample] | Lists the results of the long term retention backup operations for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionListByServer.json | -| [backupsLongTermRetentionStartSample.ts][backupslongtermretentionstartsample] | Initiates a long term retention backup. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionStart.json | -| [capabilitiesByLocationListSample.ts][capabilitiesbylocationlistsample] | Lists the capabilities available in a given location for a specific subscription. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByLocationList.json | -| [capabilitiesByServerListSample.ts][capabilitiesbyserverlistsample] | Lists the capabilities available for a given server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByServerList.json | -| [capturedLogsListByServerSample.ts][capturedlogslistbyserversample] | Lists all captured logs for download in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapturedLogsListByServer.json | -| [configurationsGetSample.ts][configurationsgetsample] | Gets information about a specific configuration (also known as server parameter) of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsGet.json | -| [configurationsListByServerSample.ts][configurationslistbyserversample] | Lists all configurations (also known as server parameters) of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsListByServer.json | -| [configurationsPutSample.ts][configurationsputsample] | Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdateUsingPut.json | -| [configurationsUpdateSample.ts][configurationsupdatesample] | Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdate.json | -| [databasesCreateSample.ts][databasescreatesample] | Creates a new database. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesCreate.json | -| [databasesDeleteSample.ts][databasesdeletesample] | Deletes an existing database. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesDelete.json | -| [databasesGetSample.ts][databasesgetsample] | Gets information about an existing database. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesGet.json | -| [databasesListByServerSample.ts][databaseslistbyserversample] | Lists all databases in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesListByServer.json | -| [firewallRulesCreateOrUpdateSample.ts][firewallrulescreateorupdatesample] | Creates a new firewall rule or updates an existing firewall rule. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesCreateOrUpdate.json | -| [firewallRulesDeleteSample.ts][firewallrulesdeletesample] | Deletes an existing firewall rule. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesDelete.json | -| [firewallRulesGetSample.ts][firewallrulesgetsample] | Gets information about a firewall rule in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesGet.json | -| [firewallRulesListByServerSample.ts][firewallruleslistbyserversample] | Lists information about all firewall rules in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesListByServer.json | -| [migrationsCancelSample.ts][migrationscancelsample] | Cancels an active migration. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCancel.json | -| [migrationsCheckNameAvailabilitySample.ts][migrationschecknameavailabilitysample] | Checks if a proposed migration name is valid and available. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCheckNameAvailability.json | -| [migrationsCreateSample.ts][migrationscreatesample] | Creates a new migration. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateValidateOnly.json | -| [migrationsGetSample.ts][migrationsgetsample] | Gets information about a migration. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationAndMigration.json | -| [migrationsListByTargetServerSample.ts][migrationslistbytargetserversample] | Lists all migrations of a target flexible server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsListByTargetServer.json | -| [migrationsUpdateSample.ts][migrationsupdatesample] | Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsUpdate.json | -| [nameAvailabilityCheckGloballySample.ts][nameavailabilitycheckgloballysample] | Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckGlobally.json | -| [nameAvailabilityCheckWithLocationSample.ts][nameavailabilitycheckwithlocationsample] | Check the availability of name for resource x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckWithLocation.json | -| [operationsListSample.ts][operationslistsample] | Lists all available REST API operations. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/OperationsList.json | -| [privateDnsZoneSuffixGetSample.ts][privatednszonesuffixgetsample] | Gets the private DNS zone suffix. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateDnsZoneSuffixGet.json | -| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | Deletes a private endpoint connection. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsDelete.json | -| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | Gets a private endpoint connection. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsGet.json | -| [privateEndpointConnectionsListByServerSample.ts][privateendpointconnectionslistbyserversample] | Lists all private endpoint connections on a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsList.json | -| [privateEndpointConnectionsUpdateSample.ts][privateendpointconnectionsupdatesample] | Approves or rejects a private endpoint connection. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsUpdate.json | -| [privateLinkResourcesGetSample.ts][privatelinkresourcesgetsample] | Gets a private link resource for PostgreSQL server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesGet.json | -| [privateLinkResourcesListByServerSample.ts][privatelinkresourceslistbyserversample] | Gets the private link resources for PostgreSQL server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesList.json | -| [quotaUsagesListSample.ts][quotausageslistsample] | Get quota usages at specified location in a given subscription. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/QuotaUsagesForFlexibleServers.json | -| [replicasListByServerSample.ts][replicaslistbyserversample] | Lists all read replicas of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ReplicasListByServer.json | -| [serverThreatProtectionSettingsCreateOrUpdateSample.ts][serverthreatprotectionsettingscreateorupdatesample] | Creates or updates a server's Advanced Threat Protection settings. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsCreateOrUpdate.json | -| [serversCreateOrUpdateSample.ts][serverscreateorupdatesample] | Creates a new server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json | -| [serversDeleteSample.ts][serversdeletesample] | Deletes or drops an existing server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersDelete.json | -| [serversGetSample.ts][serversgetsample] | Gets information about an existing server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithVnet.json | -| [serversListByResourceGroupSample.ts][serverslistbyresourcegroupsample] | Lists all servers in a resource group. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListByResourceGroup.json | -| [serversListBySubscriptionSample.ts][serverslistbysubscriptionsample] | Lists all servers in a subscription. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListBySubscription.json | -| [serversRestartSample.ts][serversrestartsample] | Restarts PostgreSQL database engine in a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestartWithFailover.json | -| [serversStartSample.ts][serversstartsample] | Starts a stopped server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStart.json | -| [serversStopSample.ts][serversstopsample] | Stops a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStop.json | -| [serversUpdateSample.ts][serversupdatesample] | Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json | -| [tuningOptionsGetSample.ts][tuningoptionsgetsample] | Gets the tuning options of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsGet.json | -| [tuningOptionsListByServerSample.ts][tuningoptionslistbyserversample] | Lists the tuning options of a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListByServer.json | -| [tuningOptionsListRecommendationsSample.ts][tuningoptionslistrecommendationssample] | Lists available object recommendations. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json | -| [virtualEndpointsCreateSample.ts][virtualendpointscreatesample] | Creates a pair of virtual endpoints for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointCreate.json | -| [virtualEndpointsDeleteSample.ts][virtualendpointsdeletesample] | Deletes a pair of virtual endpoints. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointDelete.json | -| [virtualEndpointsGetSample.ts][virtualendpointsgetsample] | Gets information about a pair of virtual endpoints. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsGet.json | -| [virtualEndpointsListByServerSample.ts][virtualendpointslistbyserversample] | Lists pair of virtual endpoints associated to a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsListByServer.json | -| [virtualEndpointsUpdateSample.ts][virtualendpointsupdatesample] | Updates a pair of virtual endpoints for a server. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointUpdate.json | -| [virtualNetworkSubnetUsageListSample.ts][virtualnetworksubnetusagelistsample] | Lists the virtual network subnet usage for a given virtual network. x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualNetworkSubnetUsageList.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/administratorsMicrosoftEntraCreateOrUpdateSample.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 -cross-env POSTGRESQL_SUBSCRIPTION_ID="" POSTGRESQL_RESOURCE_GROUP="" node dist/administratorsMicrosoftEntraCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[administratorsmicrosoftentracreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraCreateOrUpdateSample.ts -[administratorsmicrosoftentradeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraDeleteSample.ts -[administratorsmicrosoftentragetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraGetSample.ts -[administratorsmicrosoftentralistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraListByServerSample.ts -[advancedthreatprotectionsettingsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/advancedThreatProtectionSettingsGetSample.ts -[advancedthreatprotectionsettingslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/advancedThreatProtectionSettingsListByServerSample.ts -[backupsautomaticandondemandcreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandCreateSample.ts -[backupsautomaticandondemanddeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandDeleteSample.ts -[backupsautomaticandondemandgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandGetSample.ts -[backupsautomaticandondemandlistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandListByServerSample.ts -[backupslongtermretentioncheckprerequisitessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionCheckPrerequisitesSample.ts -[backupslongtermretentiongetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionGetSample.ts -[backupslongtermretentionlistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionListByServerSample.ts -[backupslongtermretentionstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionStartSample.ts -[capabilitiesbylocationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capabilitiesByLocationListSample.ts -[capabilitiesbyserverlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capabilitiesByServerListSample.ts -[capturedlogslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capturedLogsListByServerSample.ts -[configurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsGetSample.ts -[configurationslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsListByServerSample.ts -[configurationsputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsPutSample.ts -[configurationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsUpdateSample.ts -[databasescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesCreateSample.ts -[databasesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesDeleteSample.ts -[databasesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesGetSample.ts -[databaseslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesListByServerSample.ts -[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesCreateOrUpdateSample.ts -[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesDeleteSample.ts -[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesGetSample.ts -[firewallruleslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesListByServerSample.ts -[migrationscancelsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCancelSample.ts -[migrationschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCheckNameAvailabilitySample.ts -[migrationscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCreateSample.ts -[migrationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsGetSample.ts -[migrationslistbytargetserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsListByTargetServerSample.ts -[migrationsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsUpdateSample.ts -[nameavailabilitycheckgloballysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/nameAvailabilityCheckGloballySample.ts -[nameavailabilitycheckwithlocationsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/nameAvailabilityCheckWithLocationSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/operationsListSample.ts -[privatednszonesuffixgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateDnsZoneSuffixGetSample.ts -[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsDeleteSample.ts -[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsGetSample.ts -[privateendpointconnectionslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsListByServerSample.ts -[privateendpointconnectionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsUpdateSample.ts -[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateLinkResourcesGetSample.ts -[privatelinkresourceslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateLinkResourcesListByServerSample.ts -[quotausageslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/quotaUsagesListSample.ts -[replicaslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/replicasListByServerSample.ts -[serverthreatprotectionsettingscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serverThreatProtectionSettingsCreateOrUpdateSample.ts -[serverscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversCreateOrUpdateSample.ts -[serversdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversDeleteSample.ts -[serversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversGetSample.ts -[serverslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversListByResourceGroupSample.ts -[serverslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversListBySubscriptionSample.ts -[serversrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversRestartSample.ts -[serversstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversStartSample.ts -[serversstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversStopSample.ts -[serversupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversUpdateSample.ts -[tuningoptionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsGetSample.ts -[tuningoptionslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsListByServerSample.ts -[tuningoptionslistrecommendationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsListRecommendationsSample.ts -[virtualendpointscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsCreateSample.ts -[virtualendpointsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsDeleteSample.ts -[virtualendpointsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsGetSample.ts -[virtualendpointslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsListByServerSample.ts -[virtualendpointsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsUpdateSample.ts -[virtualnetworksubnetusagelistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualNetworkSubnetUsageListSample.ts -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-postgresql-flexible?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/postgresql/arm-postgresql-flexible/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraCreateOrUpdateSample.ts deleted file mode 100644 index c084e0f46caf..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraCreateOrUpdateSample.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - AdministratorMicrosoftEntraAdd} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Creates a new server administrator associated to a Microsoft Entra principal. - * - * @summary Creates a new server administrator associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraAdd.json - */ -async function addAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; - const parameters: AdministratorMicrosoftEntraAdd = { - principalName: "exampleuser@contoso.com", - principalType: "User", - tenantId: "tttttttt-tttt-tttt-tttt-tttttttttttt", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = - await client.administratorsMicrosoftEntra.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - objectId, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await addAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraDeleteSample.ts deleted file mode 100644 index c9b972b70dcf..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraDeleteSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Deletes an existing server administrator associated to a Microsoft Entra principal. - * - * @summary Deletes an existing server administrator associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraDelete.json - */ -async function deleteAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.administratorsMicrosoftEntra.beginDeleteAndWait( - resourceGroupName, - serverName, - objectId, - ); - console.log(result); -} - -async function main(): Promise { - await deleteAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraGetSample.ts deleted file mode 100644 index e452c6bf2baa..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/administratorsMicrosoftEntraGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets information about a server administrator associated to a Microsoft Entra principal. - * - * @summary Gets information about a server administrator associated to a Microsoft Entra principal. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraGet.json - */ -async function getInformationAboutAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.administratorsMicrosoftEntra.get( - resourceGroupName, - serverName, - objectId, - ); - console.log(result); -} - -async function main(): Promise { - await getInformationAboutAServerAdministratorAssociatedToAMicrosoftEntraPrincipal(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/advancedThreatProtectionSettingsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/advancedThreatProtectionSettingsGetSample.ts deleted file mode 100644 index bd3f5e18a878..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/advancedThreatProtectionSettingsGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets state of advanced threat protection settings for a server. - * - * @summary Gets state of advanced threat protection settings for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsGet.json - */ -async function getStateOfAdvancedThreatProtectionSettingsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const threatProtectionName = "Default"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.advancedThreatProtectionSettings.get( - resourceGroupName, - serverName, - threatProtectionName, - ); - console.log(result); -} - -async function main(): Promise { - await getStateOfAdvancedThreatProtectionSettingsForAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandCreateSample.ts deleted file mode 100644 index 63113c61cf49..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandCreateSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Creates an on demand backup of a server. - * - * @summary Creates an on demand backup of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandCreate.json - */ -async function createAnOnDemandBackupOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "ondemandbackup-20250601T183022"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.backupsAutomaticAndOnDemand.beginCreateAndWait( - resourceGroupName, - serverName, - backupName, - ); - console.log(result); -} - -async function main(): Promise { - await createAnOnDemandBackupOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandDeleteSample.ts deleted file mode 100644 index e233f66befd9..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandDeleteSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Deletes a specific backup, given its name. - * - * @summary Deletes a specific backup, given its name. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandDelete.json - */ -async function deleteAnOnDemandBackupGivenItsName(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "ondemandbackup-20250601T183022"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.backupsAutomaticAndOnDemand.beginDeleteAndWait( - resourceGroupName, - serverName, - backupName, - ); - console.log(result); -} - -async function main(): Promise { - await deleteAnOnDemandBackupGivenItsName(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandGetSample.ts deleted file mode 100644 index 47f839ed9d4a..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets information of an on demand backup, given its name. - * - * @summary Gets information of an on demand backup, given its name. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandGet.json - */ -async function getAnOnDemandBackupGivenItsName(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "backup_638830782181266873"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.backupsAutomaticAndOnDemand.get( - resourceGroupName, - serverName, - backupName, - ); - console.log(result); -} - -async function main(): Promise { - await getAnOnDemandBackupGivenItsName(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandListByServerSample.ts deleted file mode 100644 index 280eef99fd6e..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsAutomaticAndOnDemandListByServerSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all available backups of a server. - * - * @summary Lists all available backups of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandListByServer.json - */ -async function listAllAvailableBackupsOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.backupsAutomaticAndOnDemand.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listAllAvailableBackupsOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionCheckPrerequisitesSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionCheckPrerequisitesSample.ts deleted file mode 100644 index cec7b338be48..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionCheckPrerequisitesSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - LtrPreBackupRequest} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Performs all checks required for a long term retention backup operation to succeed. - * - * @summary Performs all checks required for a long term retention backup operation to succeed. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionCheckPrerequisites.json - */ -async function performAllChecksRequiredForALongTermRetentionBackupOperationToSucceed(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: LtrPreBackupRequest = { - backupSettings: { backupName: "exampleltrbackup" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.backupsLongTermRetention.checkPrerequisites( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await performAllChecksRequiredForALongTermRetentionBackupOperationToSucceed(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionGetSample.ts deleted file mode 100644 index 7532c17cf2a3..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets the results of a long retention backup operation for a server. - * - * @summary Gets the results of a long retention backup operation for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionGet.json - */ -async function getTheResultsOfALongRetentionBackupOperationForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const backupName = "exampleltrbackup"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.backupsLongTermRetention.get( - resourceGroupName, - serverName, - backupName, - ); - console.log(result); -} - -async function main(): Promise { - await getTheResultsOfALongRetentionBackupOperationForAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionStartSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionStartSample.ts deleted file mode 100644 index 9ea3ebfd0523..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/backupsLongTermRetentionStartSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - BackupsLongTermRetentionRequest} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Initiates a long term retention backup. - * - * @summary Initiates a long term retention backup. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionStart.json - */ -async function initiateALongTermRetentionBackup(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: BackupsLongTermRetentionRequest = { - backupSettings: { backupName: "exampleltrbackup" }, - targetDetails: { sasUriList: ["sasuri"] }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.backupsLongTermRetention.beginStartAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await initiateALongTermRetentionBackup(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capabilitiesByServerListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capabilitiesByServerListSample.ts deleted file mode 100644 index 0d5116992da2..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capabilitiesByServerListSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists the capabilities available for a given server. - * - * @summary Lists the capabilities available for a given server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByServerList.json - */ -async function listTheCapabilitiesAvailableForAGivenServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.capabilitiesByServer.list( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listTheCapabilitiesAvailableForAGivenServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capturedLogsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capturedLogsListByServerSample.ts deleted file mode 100644 index 87744a907626..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/capturedLogsListByServerSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all captured logs for download in a server. - * - * @summary Lists all captured logs for download in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapturedLogsListByServer.json - */ -async function listAllCapturedLogsForDownloadInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.capturedLogs.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listAllCapturedLogsForDownloadInAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsGetSample.ts deleted file mode 100644 index 4724f5dc2791..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets information about a specific configuration (also known as server parameter) of a server. - * - * @summary Gets information about a specific configuration (also known as server parameter) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsGet.json - */ -async function getInformationAboutASpecificConfigurationAlsoKnownAsServerParameterOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const configurationName = "array_nulls"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.configurations.get( - resourceGroupName, - serverName, - configurationName, - ); - console.log(result); -} - -async function main(): Promise { - await getInformationAboutASpecificConfigurationAlsoKnownAsServerParameterOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsPutSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsPutSample.ts deleted file mode 100644 index 53f9378f4ddf..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsPutSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - ConfigurationForUpdate} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. - * - * @summary Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdateUsingPut.json - */ -async function updateUsingPutVerbTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const configurationName = "constraint_exclusion"; - const parameters: ConfigurationForUpdate = { - source: "user-override", - value: "on", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.configurations.beginPutAndWait( - resourceGroupName, - serverName, - configurationName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await updateUsingPutVerbTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsUpdateSample.ts deleted file mode 100644 index 92333f04cff6..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/configurationsUpdateSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - ConfigurationForUpdate} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. - * - * @summary Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdate.json - */ -async function updateTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const configurationName = "constraint_exclusion"; - const parameters: ConfigurationForUpdate = { - source: "user-override", - value: "on", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.configurations.beginUpdateAndWait( - resourceGroupName, - serverName, - configurationName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await updateTheValueAssignedToASpecificModifiableConfigurationAlsoKnownAsServerParameterOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesCreateSample.ts deleted file mode 100644 index c8e06b4960c6..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesCreateSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - Database} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Creates a new database. - * - * @summary Creates a new database. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesCreate.json - */ -async function createADatabase(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const databaseName = "exampledatabase"; - const parameters: Database = { charset: "utf8", collation: "en_US.utf8" }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.databases.beginCreateAndWait( - resourceGroupName, - serverName, - databaseName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await createADatabase(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesDeleteSample.ts deleted file mode 100644 index a4345094366e..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesDeleteSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Deletes an existing database. - * - * @summary Deletes an existing database. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesDelete.json - */ -async function deleteAnExistingDatabase(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const databaseName = "exampledatabase"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.databases.beginDeleteAndWait( - resourceGroupName, - serverName, - databaseName, - ); - console.log(result); -} - -async function main(): Promise { - await deleteAnExistingDatabase(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesGetSample.ts deleted file mode 100644 index 6fbc0fc0b189..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets information about an existing database. - * - * @summary Gets information about an existing database. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesGet.json - */ -async function getInformationAboutAnExistingDatabase(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const databaseName = "exampledatabase"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.databases.get( - resourceGroupName, - serverName, - databaseName, - ); - console.log(result); -} - -async function main(): Promise { - await getInformationAboutAnExistingDatabase(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesListByServerSample.ts deleted file mode 100644 index 00f27f511229..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/databasesListByServerSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all databases in a server. - * - * @summary Lists all databases in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesListByServer.json - */ -async function listAllDatabasesInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.databases.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listAllDatabasesInAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesCreateOrUpdateSample.ts deleted file mode 100644 index d11c109ee19d..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesCreateOrUpdateSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - FirewallRule} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Creates a new firewall rule or updates an existing firewall rule. - * - * @summary Creates a new firewall rule or updates an existing firewall rule. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesCreateOrUpdate.json - */ -async function createANewFirewallRuleOrUpdateAnExistingFirewallRule(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const firewallRuleName = "examplefirewallrule"; - const parameters: FirewallRule = { - endIpAddress: "255.255.255.255", - startIpAddress: "0.0.0.0", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.firewallRules.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - firewallRuleName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await createANewFirewallRuleOrUpdateAnExistingFirewallRule(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesDeleteSample.ts deleted file mode 100644 index 798ccea0f02f..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesDeleteSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Deletes an existing firewall rule. - * - * @summary Deletes an existing firewall rule. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesDelete.json - */ -async function deleteAnExistingFirewallRule(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const firewallRuleName = "examplefirewallrule"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.firewallRules.beginDeleteAndWait( - resourceGroupName, - serverName, - firewallRuleName, - ); - console.log(result); -} - -async function main(): Promise { - await deleteAnExistingFirewallRule(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesGetSample.ts deleted file mode 100644 index 1df2b7cbe469..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets information about a firewall rule in a server. - * - * @summary Gets information about a firewall rule in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesGet.json - */ -async function getInformationAboutAFirewallRuleInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const firewallRuleName = "examplefirewallrule"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.firewallRules.get( - resourceGroupName, - serverName, - firewallRuleName, - ); - console.log(result); -} - -async function main(): Promise { - await getInformationAboutAFirewallRuleInAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesListByServerSample.ts deleted file mode 100644 index 6caff86dbf75..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/firewallRulesListByServerSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists information about all firewall rules in a server. - * - * @summary Lists information about all firewall rules in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesListByServer.json - */ -async function listInformationAboutAllFirewallRulesInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.firewallRules.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listInformationAboutAllFirewallRulesInAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCancelSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCancelSample.ts deleted file mode 100644 index 58341bdf3e82..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCancelSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Cancels an active migration. - * - * @summary Cancels an active migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCancel.json - */ -async function cancelAnActiveMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.cancel( - resourceGroupName, - serverName, - migrationName, - ); - console.log(result); -} - -async function main(): Promise { - await cancelAnActiveMigration(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCheckNameAvailabilitySample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCheckNameAvailabilitySample.ts deleted file mode 100644 index cfd2c1a0eeeb..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCheckNameAvailabilitySample.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - MigrationNameAvailability} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Checks if a proposed migration name is valid and available. - * - * @summary Checks if a proposed migration name is valid and available. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCheckNameAvailability.json - */ -async function checkTheValidityAndAvailabilityOfTheGivenNameToAssignItToANewMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: MigrationNameAvailability = { - name: "examplemigration", - type: "Microsoft.DBforPostgreSQL/flexibleServers/migrations", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.checkNameAvailability( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await checkTheValidityAndAvailabilityOfTheGivenNameToAssignItToANewMigration(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCreateSample.ts deleted file mode 100644 index fbe524b7d2ce..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsCreateSample.ts +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - Migration} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateValidateOnly.json - */ -async function createAMigrationForValidatingOnly(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - migrationOption: "Validate", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithOtherUsers.json - */ -async function createAMigrationSpecifyingUserNames(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - sourceServerUsername: "newadmin@examplesource", - targetServerUsername: "targetadmin", - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithFullyQualifiedDomainName.json - */ -async function createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "xxxxxxxx", - targetServerPassword: "xxxxxxxx", - }, - }, - sourceDbServerFullyQualifiedDomainName: "examplesource.contoso.com", - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - targetDbServerFullyQualifiedDomainName: "exampletarget.contoso.com", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateOtherSourceTypesValidateMigrate.json - */ -async function createAMigrationWithOtherSourceTypeForValidatingAndMigrating(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - migrationOption: "ValidateAndMigrate", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: "examplesource:5432@exampleuser", - sourceType: "OnPremises", - sslMode: "Prefer", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithPrivateEndpointServers.json - */ -async function createAMigrationWithPrivateEndpoint(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationInstanceResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/examplesourcemigration", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithRoles.json - */ -async function createAMigrationWithRoles(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrateRoles: "True", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Creates a new migration. - * - * @summary Creates a new migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreate.json - */ -async function createAMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: Migration = { - dbsToMigrate: [ - "exampledatabase1", - "exampledatabase2", - "exampledatabase3", - "exampledatabase4", - ], - location: "eastus", - migrationMode: "Offline", - overwriteDbsInTarget: "True", - secretParameters: { - adminCredentials: { - sourceServerPassword: "examplesourcepassword", - targetServerPassword: "exampletargetpassword", - }, - }, - sourceDbServerResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.create( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await createAMigrationForValidatingOnly(); - await createAMigrationSpecifyingUserNames(); - await createAMigrationWithFullyQualifiedDomainNamesForSourceAndTargetServers(); - await createAMigrationWithOtherSourceTypeForValidatingAndMigrating(); - await createAMigrationWithPrivateEndpoint(); - await createAMigrationWithRoles(); - await createAMigration(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsGetSample.ts deleted file mode 100644 index 90a41d4eeb1d..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsGetSample.ts +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationAndMigration.json - */ -async function getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationButMigrationFailure.json - */ -async function getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationOnly.json - */ -async function getInformationAboutAMigrationWithSuccessfulValidationOnly(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithValidationFailures.json - */ -async function getInformationAboutAMigrationWithValidationFailures(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about a migration. - * - * @summary Gets information about a migration. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGet.json - */ -async function getInformationAboutAMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.get( - resourceGroupName, - serverName, - migrationName, - ); - console.log(result); -} - -async function main(): Promise { - await getInformationAboutAMigrationWithSuccessfulValidationAndSuccessfulMigration(); - await getInformationAboutAMigrationWithSuccessfulValidationButFailedMigration(); - await getInformationAboutAMigrationWithSuccessfulValidationOnly(); - await getInformationAboutAMigrationWithValidationFailures(); - await getInformationAboutAMigration(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsListByTargetServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsListByTargetServerSample.ts deleted file mode 100644 index 581f1abc26fe..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsListByTargetServerSample.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - MigrationsListByTargetServerOptionalParams} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all migrations of a target flexible server. - * - * @summary Lists all migrations of a target flexible server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsListByTargetServer.json - */ -async function listAllMigrationsOfATargetFlexibleServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationListFilter = "All"; - const options: MigrationsListByTargetServerOptionalParams = { - migrationListFilter, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.migrations.listByTargetServer( - resourceGroupName, - serverName, - options, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listAllMigrationsOfATargetFlexibleServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsUpdateSample.ts deleted file mode 100644 index ae92d66fbd6b..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/migrationsUpdateSample.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - MigrationResourceForPatch} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - * - * @summary Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsUpdate.json - */ -async function updateAnExistingMigration(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const migrationName = "examplemigration"; - const parameters: MigrationResourceForPatch = { - setupLogicalReplicationOnSourceDbIfNeeded: "True", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.migrations.update( - resourceGroupName, - serverName, - migrationName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await updateAnExistingMigration(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/nameAvailabilityCheckWithLocationSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/nameAvailabilityCheckWithLocationSample.ts deleted file mode 100644 index c7f515faafdf..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/nameAvailabilityCheckWithLocationSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - CheckNameAvailabilityRequest} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Check the availability of name for resource - * - * @summary Check the availability of name for resource - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckWithLocation.json - */ -async function checkTheValidityAndAvailabilityOfTheGivenNameInTheGivenLocationToAssignItToANewServerOrToUseItAsTheBaseNameOfANewPairOfVirtualEndpoints(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; - const parameters: CheckNameAvailabilityRequest = { - name: "exampleserver", - type: "Microsoft.DBforPostgreSQL/flexibleServers", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.nameAvailability.checkWithLocation( - locationName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await checkTheValidityAndAvailabilityOfTheGivenNameInTheGivenLocationToAssignItToANewServerOrToUseItAsTheBaseNameOfANewPairOfVirtualEndpoints(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/operationsListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/operationsListSample.ts deleted file mode 100644 index dabec6104b06..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all available REST API operations. - * - * @summary Lists all available REST API operations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/OperationsList.json - */ -async function listAllAvailableRestApiOperations(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listAllAvailableRestApiOperations(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsDeleteSample.ts deleted file mode 100644 index c70950b49854..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsDeleteSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Deletes a private endpoint connection. - * - * @summary Deletes a private endpoint connection. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsDelete.json - */ -async function deleteAPrivateEndpointConnection(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const privateEndpointConnectionName = - "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.privateEndpointConnections.beginDeleteAndWait( - resourceGroupName, - serverName, - privateEndpointConnectionName, - ); - console.log(result); -} - -async function main(): Promise { - await deleteAPrivateEndpointConnection(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsGetSample.ts deleted file mode 100644 index 07eaf85c7fb9..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsGetSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets a private endpoint connection. - * - * @summary Gets a private endpoint connection. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsGet.json - */ -async function getAPrivateEndpointConnection(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const privateEndpointConnectionName = - "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.privateEndpointConnections.get( - resourceGroupName, - serverName, - privateEndpointConnectionName, - ); - console.log(result); -} - -async function main(): Promise { - await getAPrivateEndpointConnection(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsListByServerSample.ts deleted file mode 100644 index c401c5698fbd..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsListByServerSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all private endpoint connections on a server. - * - * @summary Lists all private endpoint connections on a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsList.json - */ -async function listAllPrivateEndpointConnectionsOnAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.privateEndpointConnections.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listAllPrivateEndpointConnectionsOnAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsUpdateSample.ts deleted file mode 100644 index 98ce24773a9e..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateEndpointConnectionsUpdateSample.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - PrivateEndpointConnection} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Approves or rejects a private endpoint connection. - * - * @summary Approves or rejects a private endpoint connection. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsUpdate.json - */ -async function approveOrRejectAPrivateEndpointConnection(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const privateEndpointConnectionName = - "private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e"; - const parameters: PrivateEndpointConnection = { - privateLinkServiceConnectionState: { - description: "Approved by johndoe@contoso.com", - status: "Approved", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.privateEndpointConnections.beginUpdateAndWait( - resourceGroupName, - serverName, - privateEndpointConnectionName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await approveOrRejectAPrivateEndpointConnection(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateLinkResourcesGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateLinkResourcesGetSample.ts deleted file mode 100644 index 9485f508ccad..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateLinkResourcesGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets a private link resource for PostgreSQL server. - * - * @summary Gets a private link resource for PostgreSQL server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesGet.json - */ -async function getsAPrivateLinkResourceForPostgreSql(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const groupName = "exampleprivatelink"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.privateLinkResources.get( - resourceGroupName, - serverName, - groupName, - ); - console.log(result); -} - -async function main(): Promise { - await getsAPrivateLinkResourceForPostgreSql(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateLinkResourcesListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateLinkResourcesListByServerSample.ts deleted file mode 100644 index 9cbdd634d941..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/privateLinkResourcesListByServerSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets the private link resources for PostgreSQL server. - * - * @summary Gets the private link resources for PostgreSQL server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesList.json - */ -async function getsPrivateLinkResourcesForPostgreSql(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.privateLinkResources.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await getsPrivateLinkResourcesForPostgreSql(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/quotaUsagesListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/quotaUsagesListSample.ts deleted file mode 100644 index 94f1f00006a8..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/quotaUsagesListSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get quota usages at specified location in a given subscription. - * - * @summary Get quota usages at specified location in a given subscription. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/QuotaUsagesForFlexibleServers.json - */ -async function listOfQuotaUsagesForServers(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.quotaUsages.list(locationName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listOfQuotaUsagesForServers(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/replicasListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/replicasListByServerSample.ts deleted file mode 100644 index cb0976981bd2..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/replicasListByServerSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all read replicas of a server. - * - * @summary Lists all read replicas of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ReplicasListByServer.json - */ -async function listAllReadReplicasOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.replicas.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listAllReadReplicasOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serverThreatProtectionSettingsCreateOrUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serverThreatProtectionSettingsCreateOrUpdateSample.ts deleted file mode 100644 index bbd782798e60..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serverThreatProtectionSettingsCreateOrUpdateSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - AdvancedThreatProtectionSettingsModel} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Creates or updates a server's Advanced Threat Protection settings. - * - * @summary Creates or updates a server's Advanced Threat Protection settings. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsCreateOrUpdate.json - */ -async function updateTheAdvancedThreatProtectionSettingsOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const threatProtectionName = "Default"; - const parameters: AdvancedThreatProtectionSettingsModel = { - state: "Enabled", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = - await client.serverThreatProtectionSettings.beginCreateOrUpdateAndWait( - resourceGroupName, - serverName, - threatProtectionName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await updateTheAdvancedThreatProtectionSettingsOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversDeleteSample.ts deleted file mode 100644 index cc497336f75b..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversDeleteSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Deletes or drops an existing server. - * - * @summary Deletes or drops an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersDelete.json - */ -async function deleteOrDropAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginDeleteAndWait( - resourceGroupName, - serverName, - ); - console.log(result); -} - -async function main(): Promise { - await deleteOrDropAnExistingServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversGetSample.ts deleted file mode 100644 index 00c12dd789c9..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversGetSample.ts +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets information about an existing server. - * - * @summary Gets information about an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithVnet.json - */ -async function getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.get(resourceGroupName, serverName); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about an existing server. - * - * @summary Gets information about an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithPrivateEndpoints.json - */ -async function getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.get(resourceGroupName, serverName); - console.log(result); -} - -/** - * This sample demonstrates how to Gets information about an existing server. - * - * @summary Gets information about an existing server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGet.json - */ -async function getInformationAboutAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.get(resourceGroupName, serverName); - console.log(result); -} - -async function main(): Promise { - await getInformationAboutAnExistingServerThatIsIntegratedIntoAVirtualNetworkProvidedByCustomer(); - await getInformationAboutAnExistingServerThatIsnTIntegratedIntoAVirtualNetworkProvidedByCustomerAndHasPrivateEndpointConnections(); - await getInformationAboutAnExistingServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversListByResourceGroupSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversListByResourceGroupSample.ts deleted file mode 100644 index 44b95465d046..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversListByResourceGroupSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists all servers in a resource group. - * - * @summary Lists all servers in a resource group. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListByResourceGroup.json - */ -async function listAllServersInAResourceGroup(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.servers.listByResourceGroup( - resourceGroupName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listAllServersInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversRestartSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversRestartSample.ts deleted file mode 100644 index 0edcd6ffb798..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversRestartSample.ts +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - RestartParameter, - ServersRestartOptionalParams} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Restarts PostgreSQL database engine in a server. - * - * @summary Restarts PostgreSQL database engine in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestartWithFailover.json - */ -async function restartPostgreSqlDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: RestartParameter = { - failoverMode: "ForcedFailover", - restartWithFailover: true, - }; - const options: ServersRestartOptionalParams = { parameters }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginRestartAndWait( - resourceGroupName, - serverName, - options, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Restarts PostgreSQL database engine in a server. - * - * @summary Restarts PostgreSQL database engine in a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestart.json - */ -async function restartPostgreSqlDatabaseEngineInAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginRestartAndWait( - resourceGroupName, - serverName, - ); - console.log(result); -} - -async function main(): Promise { - await restartPostgreSqlDatabaseEngineInAServerWithAForcedFailoverToStandbyServer(); - await restartPostgreSqlDatabaseEngineInAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversStartSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversStartSample.ts deleted file mode 100644 index 9ad3ec397615..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversStartSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Starts a stopped server. - * - * @summary Starts a stopped server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStart.json - */ -async function startAStoppedServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginStartAndWait( - resourceGroupName, - serverName, - ); - console.log(result); -} - -async function main(): Promise { - await startAStoppedServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversStopSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversStopSample.ts deleted file mode 100644 index 9ed4eb2ce206..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversStopSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Stops a server. - * - * @summary Stops a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStop.json - */ -async function stopAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginStopAndWait( - resourceGroupName, - serverName, - ); - console.log(result); -} - -async function main(): Promise { - await stopAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversUpdateSample.ts deleted file mode 100644 index d58545d0a9c8..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/serversUpdateSample.ts +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - ServerForPatch} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json - */ -async function promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - replica: { promoteMode: "Standalone", promoteOption: "Forced" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedStandaloneServer.json - */ -async function promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - replica: { promoteMode: "Standalone", promoteOption: "Planned" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedSwitchover.json - */ -async function switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - replica: { promoteMode: "Switchover", promoteOption: "Forced" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedSwitchover.json - */ -async function switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - replica: { promoteMode: "Switchover", promoteOption: "Planned" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMajorVersionUpgrade.json - */ -async function updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSqlDatabaseEngine(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { createMode: "Update", version: "17" }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMicrosoftEntraEnabled.json - */ -async function updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - administratorLoginPassword: "examplenewpassword", - authConfig: { - activeDirectoryAuth: "Enabled", - passwordAuth: "Enabled", - tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt", - }, - backup: { backupRetentionDays: 20 }, - createMode: "Update", - sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - storage: { autoGrow: "Disabled", storageSizeGB: 1024, tier: "P30" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithCustomMaintenanceWindow.json - */ -async function updateAnExistingServerWithCustomMaintenanceWindow(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - createMode: "Update", - maintenanceWindow: { - customWindow: "Enabled", - dayOfWeek: 0, - startHour: 8, - startMinute: 0, - }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json - */ -async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - administratorLoginPassword: "examplenewpassword", - backup: { backupRetentionDays: 20 }, - createMode: "Update", - dataEncryption: { - type: "AzureKeyVault", - geoBackupKeyURI: - "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", - geoBackupUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", - primaryUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", - }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabled.json - */ -async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - administratorLoginPassword: "examplenewpassword", - backup: { backupRetentionDays: 20 }, - createMode: "Update", - dataEncryption: { - type: "AzureKeyVault", - geoBackupKeyURI: - "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", - geoBackupUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", - primaryKeyURI: - "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - primaryUserAssignedIdentityId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", - }, - identity: { - type: "UserAssigned", - userAssignedIdentities: { - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": - {}, - "/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity": - {}, - }, - }, - sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -/** - * This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * - * @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json - */ -async function updateAnExistingServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const parameters: ServerForPatch = { - administratorLoginPassword: "examplenewpassword", - backup: { backupRetentionDays: 20 }, - createMode: "Update", - sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" }, - storage: { autoGrow: "Enabled", storageSizeGB: 1024, tier: "P30" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.servers.beginUpdateAndWait( - resourceGroupName, - serverName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); - await promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(); - await switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(); - await switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(); - await updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSqlDatabaseEngine(); - await updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(); - await updateAnExistingServerWithCustomMaintenanceWindow(); - await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(); - await updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(); - await updateAnExistingServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsGetSample.ts deleted file mode 100644 index 52d81c4d1449..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets the tuning options of a server. - * - * @summary Gets the tuning options of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsGet.json - */ -async function getTheTuningOptionsOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "index"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.tuningOptionsOperations.get( - resourceGroupName, - serverName, - tuningOption, - ); - console.log(result); -} - -async function main(): Promise { - await getTheTuningOptionsOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsListByServerSample.ts deleted file mode 100644 index 24685d90c4e9..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsListByServerSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists the tuning options of a server. - * - * @summary Lists the tuning options of a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListByServer.json - */ -async function listTheTuningOptionsOfAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listTheTuningOptionsOfAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsListRecommendationsSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsListRecommendationsSample.ts deleted file mode 100644 index a3be87c8a681..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/tuningOptionsListRecommendationsSample.ts +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - TuningOptionsListRecommendationsOptionalParams} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists available object recommendations. - * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json - */ -async function listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "index"; - const recommendationType = "CreateIndex"; - const options: TuningOptionsListRecommendationsOptionalParams = { - recommendationType, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - options, - )) { - resArray.push(item); - } - console.log(resArray); -} - -/** - * This sample demonstrates how to Lists available object recommendations. - * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendations.json - */ -async function listAvailableIndexRecommendations(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "index"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - )) { - resArray.push(item); - } - console.log(resArray); -} - -/** - * This sample demonstrates how to Lists available object recommendations. - * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json - */ -async function listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "table"; - const recommendationType = "AnalyzeTable"; - const options: TuningOptionsListRecommendationsOptionalParams = { - recommendationType, - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - options, - )) { - resArray.push(item); - } - console.log(resArray); -} - -/** - * This sample demonstrates how to Lists available object recommendations. - * - * @summary Lists available object recommendations. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendations.json - */ -async function listAvailableTableRecommendations(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const tuningOption = "table"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.tuningOptionsOperations.listRecommendations( - resourceGroupName, - serverName, - tuningOption, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listAvailableIndexRecommendationsFilteredToExclusivelyGetThoseOfCreateIndexType(); - await listAvailableIndexRecommendations(); - await listAvailableTableRecommendationsFilteredToExclusivelyGetThoseOfAnalyzeTableType(); - await listAvailableTableRecommendations(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsCreateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsCreateSample.ts deleted file mode 100644 index 7a55d067dfae..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsCreateSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - VirtualEndpoint} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Creates a pair of virtual endpoints for a server. - * - * @summary Creates a pair of virtual endpoints for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointCreate.json - */ -async function createAPairOfVirtualEndpointsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; - const parameters: VirtualEndpoint = { - endpointType: "ReadWrite", - members: ["exampleprimaryserver"], - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.virtualEndpoints.beginCreateAndWait( - resourceGroupName, - serverName, - virtualEndpointName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await createAPairOfVirtualEndpointsForAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsDeleteSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsDeleteSample.ts deleted file mode 100644 index 3e05399f9736..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsDeleteSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Deletes a pair of virtual endpoints. - * - * @summary Deletes a pair of virtual endpoints. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointDelete.json - */ -async function deleteAPairOfVirtualEndpoints(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.virtualEndpoints.beginDeleteAndWait( - resourceGroupName, - serverName, - virtualEndpointName, - ); - console.log(result); -} - -async function main(): Promise { - await deleteAPairOfVirtualEndpoints(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsGetSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsGetSample.ts deleted file mode 100644 index 1c027f52f526..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsGetSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets information about a pair of virtual endpoints. - * - * @summary Gets information about a pair of virtual endpoints. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsGet.json - */ -async function getInformationAboutAPairOfVirtualEndpoints(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.virtualEndpoints.get( - resourceGroupName, - serverName, - virtualEndpointName, - ); - console.log(result); -} - -async function main(): Promise { - await getInformationAboutAPairOfVirtualEndpoints(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsListByServerSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsListByServerSample.ts deleted file mode 100644 index 540561e18473..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsListByServerSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { PostgreSQLManagementFlexibleServerClient } from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists pair of virtual endpoints associated to a server. - * - * @summary Lists pair of virtual endpoints associated to a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsListByServer.json - */ -async function listPairOfVirtualEndpointsAssociatedToAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (const item of client.virtualEndpoints.listByServer( - resourceGroupName, - serverName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - await listPairOfVirtualEndpointsAssociatedToAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsUpdateSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsUpdateSample.ts deleted file mode 100644 index 3c854fd9cf81..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualEndpointsUpdateSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - VirtualEndpointResourceForPatch} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Updates a pair of virtual endpoints for a server. - * - * @summary Updates a pair of virtual endpoints for a server. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointUpdate.json - */ -async function updateAPairOfVirtualEndpointsForAServer(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup"; - const serverName = "exampleserver"; - const virtualEndpointName = "examplebasename"; - const parameters: VirtualEndpointResourceForPatch = { - endpointType: "ReadWrite", - members: ["exampleprimaryserver"], - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.virtualEndpoints.beginUpdateAndWait( - resourceGroupName, - serverName, - virtualEndpointName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await updateAPairOfVirtualEndpointsForAServer(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualNetworkSubnetUsageListSample.ts b/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualNetworkSubnetUsageListSample.ts deleted file mode 100644 index 2d1b0b296568..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/samples/v9/typescript/src/virtualNetworkSubnetUsageListSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - VirtualNetworkSubnetUsageParameter} from "@azure/arm-postgresql-flexible"; -import { - PostgreSQLManagementFlexibleServerClient, -} from "@azure/arm-postgresql-flexible"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists the virtual network subnet usage for a given virtual network. - * - * @summary Lists the virtual network subnet usage for a given virtual network. - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualNetworkSubnetUsageList.json - */ -async function listTheVirtualNetworkSubnetUsageForAGivenVirtualNetwork(): Promise { - const subscriptionId = - process.env["POSTGRESQL_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const locationName = "eastus"; - const parameters: VirtualNetworkSubnetUsageParameter = { - virtualNetworkArmResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork", - }; - const credential = new DefaultAzureCredential(); - const client = new PostgreSQLManagementFlexibleServerClient( - credential, - subscriptionId, - ); - const result = await client.virtualNetworkSubnetUsage.list( - locationName, - parameters, - ); - console.log(result); -} - -async function main(): Promise { - await listTheVirtualNetworkSubnetUsageForAGivenVirtualNetwork(); -} - -main().catch(console.error); diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/administratorsMicrosoftEntra/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/administratorsMicrosoftEntra/index.ts new file mode 100644 index 000000000000..de32733d1420 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/administratorsMicrosoftEntra/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, $delete, createOrUpdate, get } from "./operations.js"; +export type { + AdministratorsMicrosoftEntraListByServerOptionalParams, + AdministratorsMicrosoftEntraDeleteOptionalParams, + AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + AdministratorsMicrosoftEntraGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/administratorsMicrosoftEntra/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/administratorsMicrosoftEntra/operations.ts new file mode 100644 index 000000000000..2442f04c3cfa --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/administratorsMicrosoftEntra/operations.ts @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + AdministratorMicrosoftEntra, + AdministratorMicrosoftEntraAdd, + _AdministratorMicrosoftEntraList, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + administratorMicrosoftEntraDeserializer, + administratorMicrosoftEntraAddSerializer, + _administratorMicrosoftEntraListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + AdministratorsMicrosoftEntraListByServerOptionalParams, + AdministratorsMicrosoftEntraDeleteOptionalParams, + AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + AdministratorsMicrosoftEntraGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: AdministratorsMicrosoftEntraListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_AdministratorMicrosoftEntraList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _administratorMicrosoftEntraListDeserializer(result.body); +} + +/** List all server administrators associated to a Microsoft Entra principal. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: AdministratorsMicrosoftEntraListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + serverName: string, + objectId: string, + options: AdministratorsMicrosoftEntraDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + objectId: objectId, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Deletes an existing server administrator associated to a Microsoft Entra principal. */ +/** + * @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, + serverName: string, + objectId: string, + options: AdministratorsMicrosoftEntraDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, serverName, objectId, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + serverName: string, + objectId: string, + parameters: AdministratorMicrosoftEntraAdd, + options: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + objectId: objectId, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: administratorMicrosoftEntraAddSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return administratorMicrosoftEntraDeserializer(result.body); +} + +/** Creates a new server administrator associated to a Microsoft Entra principal. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + serverName: string, + objectId: string, + parameters: AdministratorMicrosoftEntraAdd, + options: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, AdministratorMicrosoftEntra> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, serverName, objectId, parameters, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, AdministratorMicrosoftEntra>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + objectId: string, + options: AdministratorsMicrosoftEntraGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + objectId: objectId, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return administratorMicrosoftEntraDeserializer(result.body); +} + +/** Gets information about a server administrator associated to a Microsoft Entra principal. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + objectId: string, + options: AdministratorsMicrosoftEntraGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, objectId, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/administratorsMicrosoftEntra/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/administratorsMicrosoftEntra/options.ts new file mode 100644 index 000000000000..6a1d9c03b6a2 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/administratorsMicrosoftEntra/options.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface AdministratorsMicrosoftEntraListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AdministratorsMicrosoftEntraDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AdministratorsMicrosoftEntraGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/advancedThreatProtectionSettings/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/advancedThreatProtectionSettings/index.ts new file mode 100644 index 000000000000..a11ff00fb862 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/advancedThreatProtectionSettings/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, get } from "./operations.js"; +export type { + AdvancedThreatProtectionSettingsListByServerOptionalParams, + AdvancedThreatProtectionSettingsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/advancedThreatProtectionSettings/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/advancedThreatProtectionSettings/operations.ts new file mode 100644 index 000000000000..dbd697773fd2 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/advancedThreatProtectionSettings/operations.ts @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + AdvancedThreatProtectionSettingsModel, + ThreatProtectionName, + _AdvancedThreatProtectionSettingsList, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + advancedThreatProtectionSettingsModelDeserializer, + _advancedThreatProtectionSettingsListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + AdvancedThreatProtectionSettingsListByServerOptionalParams, + AdvancedThreatProtectionSettingsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: AdvancedThreatProtectionSettingsListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_AdvancedThreatProtectionSettingsList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _advancedThreatProtectionSettingsListDeserializer(result.body); +} + +/** Lists state of advanced threat protection settings for a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: AdvancedThreatProtectionSettingsListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + options: AdvancedThreatProtectionSettingsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + threatProtectionName: threatProtectionName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return advancedThreatProtectionSettingsModelDeserializer(result.body); +} + +/** Gets state of advanced threat protection settings for a server. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + options: AdvancedThreatProtectionSettingsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + serverName, + threatProtectionName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/advancedThreatProtectionSettings/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/advancedThreatProtectionSettings/options.ts new file mode 100644 index 000000000000..3dac2e97edcb --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/advancedThreatProtectionSettings/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface AdvancedThreatProtectionSettingsListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AdvancedThreatProtectionSettingsGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/backupsAutomaticAndOnDemand/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsAutomaticAndOnDemand/index.ts new file mode 100644 index 000000000000..0c095cd71cb0 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsAutomaticAndOnDemand/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, $delete, create, get } from "./operations.js"; +export type { + BackupsAutomaticAndOnDemandListByServerOptionalParams, + BackupsAutomaticAndOnDemandDeleteOptionalParams, + BackupsAutomaticAndOnDemandCreateOptionalParams, + BackupsAutomaticAndOnDemandGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/backupsAutomaticAndOnDemand/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsAutomaticAndOnDemand/operations.ts new file mode 100644 index 000000000000..3d2583b26fed --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsAutomaticAndOnDemand/operations.ts @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + BackupAutomaticAndOnDemand, + _BackupAutomaticAndOnDemandList, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + backupAutomaticAndOnDemandDeserializer, + _backupAutomaticAndOnDemandListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + BackupsAutomaticAndOnDemandListByServerOptionalParams, + BackupsAutomaticAndOnDemandDeleteOptionalParams, + BackupsAutomaticAndOnDemandCreateOptionalParams, + BackupsAutomaticAndOnDemandGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: BackupsAutomaticAndOnDemandListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_BackupAutomaticAndOnDemandList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _backupAutomaticAndOnDemandListDeserializer(result.body); +} + +/** Lists all available backups of a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: BackupsAutomaticAndOnDemandListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + serverName: string, + backupName: string, + options: BackupsAutomaticAndOnDemandDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + backupName: backupName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Deletes a specific backup, given its name. */ +/** + * @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, + serverName: string, + backupName: string, + options: BackupsAutomaticAndOnDemandDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, serverName, backupName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + serverName: string, + backupName: string, + options: BackupsAutomaticAndOnDemandCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + backupName: backupName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return backupAutomaticAndOnDemandDeserializer(result.body); +} + +/** Creates an on demand backup of a server. */ +export function create( + context: Client, + resourceGroupName: string, + serverName: string, + backupName: string, + options: BackupsAutomaticAndOnDemandCreateOptionalParams = { requestOptions: {} }, +): PollerLike, BackupAutomaticAndOnDemand> { + return getLongRunningPoller(context, _createDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend(context, resourceGroupName, serverName, backupName, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, BackupAutomaticAndOnDemand>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + backupName: string, + options: BackupsAutomaticAndOnDemandGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + backupName: backupName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return backupAutomaticAndOnDemandDeserializer(result.body); +} + +/** Gets information of an on demand backup, given its name. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + backupName: string, + options: BackupsAutomaticAndOnDemandGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, backupName, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/backupsAutomaticAndOnDemand/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsAutomaticAndOnDemand/options.ts new file mode 100644 index 000000000000..fb234bb169d4 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsAutomaticAndOnDemand/options.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface BackupsAutomaticAndOnDemandListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface BackupsAutomaticAndOnDemandDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface BackupsAutomaticAndOnDemandCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface BackupsAutomaticAndOnDemandGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/backupsLongTermRetention/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsLongTermRetention/index.ts new file mode 100644 index 000000000000..62db6384d0ee --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsLongTermRetention/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, get, start, checkPrerequisites } from "./operations.js"; +export type { + BackupsLongTermRetentionListByServerOptionalParams, + BackupsLongTermRetentionGetOptionalParams, + BackupsLongTermRetentionStartOptionalParams, + BackupsLongTermRetentionCheckPrerequisitesOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/backupsLongTermRetention/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsLongTermRetention/operations.ts new file mode 100644 index 000000000000..b5759fed40f4 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsLongTermRetention/operations.ts @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + LtrPreBackupRequest, + LtrPreBackupResponse, + BackupsLongTermRetentionRequest, + BackupsLongTermRetentionResponse, + BackupsLongTermRetentionOperation, + _LtrServerBackupOperationList, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + ltrPreBackupRequestSerializer, + ltrPreBackupResponseDeserializer, + backupsLongTermRetentionRequestSerializer, + backupsLongTermRetentionResponseDeserializer, + backupsLongTermRetentionOperationDeserializer, + _ltrServerBackupOperationListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + BackupsLongTermRetentionListByServerOptionalParams, + BackupsLongTermRetentionGetOptionalParams, + BackupsLongTermRetentionStartOptionalParams, + BackupsLongTermRetentionCheckPrerequisitesOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: BackupsLongTermRetentionListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_LtrServerBackupOperationList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _ltrServerBackupOperationListDeserializer(result.body); +} + +/** Lists the results of the long term retention backup operations for a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: BackupsLongTermRetentionListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + backupName: string, + options: BackupsLongTermRetentionGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations/{backupName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + backupName: backupName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return backupsLongTermRetentionOperationDeserializer(result.body); +} + +/** Gets the results of a long retention backup operation for a server. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + backupName: string, + options: BackupsLongTermRetentionGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, backupName, options); + return _getDeserialize(result); +} + +export function _startSend( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: BackupsLongTermRetentionRequest, + options: BackupsLongTermRetentionStartOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/startLtrBackup{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: backupsLongTermRetentionRequestSerializer(parameters), + }); +} + +export async function _startDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return backupsLongTermRetentionResponseDeserializer(result.body); +} + +/** Initiates a long term retention backup. */ +export function start( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: BackupsLongTermRetentionRequest, + options: BackupsLongTermRetentionStartOptionalParams = { requestOptions: {} }, +): PollerLike, BackupsLongTermRetentionResponse> { + return getLongRunningPoller(context, _startDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _startSend(context, resourceGroupName, serverName, parameters, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike< + OperationState, + BackupsLongTermRetentionResponse + >; +} + +export function _checkPrerequisitesSend( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: LtrPreBackupRequest, + options: BackupsLongTermRetentionCheckPrerequisitesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrPreBackup{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: ltrPreBackupRequestSerializer(parameters), + }); +} + +export async function _checkPrerequisitesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return ltrPreBackupResponseDeserializer(result.body); +} + +/** Performs all checks required for a long term retention backup operation to succeed. */ +export async function checkPrerequisites( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: LtrPreBackupRequest, + options: BackupsLongTermRetentionCheckPrerequisitesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _checkPrerequisitesSend( + context, + resourceGroupName, + serverName, + parameters, + options, + ); + return _checkPrerequisitesDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/backupsLongTermRetention/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsLongTermRetention/options.ts new file mode 100644 index 000000000000..b95763a8122a --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/backupsLongTermRetention/options.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface BackupsLongTermRetentionListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface BackupsLongTermRetentionGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface BackupsLongTermRetentionStartOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface BackupsLongTermRetentionCheckPrerequisitesOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByLocation/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByLocation/index.ts new file mode 100644 index 000000000000..ecc3c2d44345 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByLocation/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export type { CapabilitiesByLocationListOptionalParams } from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByLocation/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByLocation/operations.ts new file mode 100644 index 000000000000..b93aa8067cbe --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByLocation/operations.ts @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { _CapabilityList, Capability } from "../../models/models.js"; +import { errorResponseDeserializer, _capabilityListDeserializer } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { CapabilitiesByLocationListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + locationName: string, + options: CapabilitiesByLocationListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + locationName: locationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + 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<_CapabilityList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _capabilityListDeserializer(result.body); +} + +/** Lists the capabilities available in a given location for a specific subscription. */ +export function list( + context: Client, + locationName: string, + options: CapabilitiesByLocationListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, locationName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByLocation/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByLocation/options.ts new file mode 100644 index 000000000000..ff58bf136615 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByLocation/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CapabilitiesByLocationListOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByServer/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByServer/index.ts new file mode 100644 index 000000000000..f2f3ab924f35 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByServer/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export type { CapabilitiesByServerListOptionalParams } from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByServer/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByServer/operations.ts new file mode 100644 index 000000000000..6999ecd42179 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByServer/operations.ts @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { _CapabilityList, Capability } from "../../models/models.js"; +import { errorResponseDeserializer, _capabilityListDeserializer } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { CapabilitiesByServerListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: CapabilitiesByServerListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/capabilities{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + 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<_CapabilityList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _capabilityListDeserializer(result.body); +} + +/** Lists the capabilities available for a given server. */ +export function list( + context: Client, + resourceGroupName: string, + serverName: string, + options: CapabilitiesByServerListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, resourceGroupName, serverName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByServer/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByServer/options.ts new file mode 100644 index 000000000000..849e141597a6 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/capabilitiesByServer/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CapabilitiesByServerListOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/capturedLogs/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/capturedLogs/index.ts new file mode 100644 index 000000000000..ee4ec036c28a --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/capturedLogs/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer } from "./operations.js"; +export type { CapturedLogsListByServerOptionalParams } from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/capturedLogs/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/capturedLogs/operations.ts new file mode 100644 index 000000000000..71b93a9a7c8f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/capturedLogs/operations.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { _CapturedLogList, CapturedLog } from "../../models/models.js"; +import { errorResponseDeserializer, _capturedLogListDeserializer } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { CapturedLogsListByServerOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: CapturedLogsListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/logFiles{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_CapturedLogList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _capturedLogListDeserializer(result.body); +} + +/** Lists all captured logs for download in a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: CapturedLogsListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/capturedLogs/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/capturedLogs/options.ts new file mode 100644 index 000000000000..6ad289362bbb --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/capturedLogs/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CapturedLogsListByServerOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/configurations/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/configurations/index.ts new file mode 100644 index 000000000000..b1299ee7ae67 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/configurations/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, update, put, get } from "./operations.js"; +export type { + ConfigurationsListByServerOptionalParams, + ConfigurationsUpdateOptionalParams, + ConfigurationsPutOptionalParams, + ConfigurationsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/configurations/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/configurations/operations.ts new file mode 100644 index 000000000000..8cf3ff93b5bb --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/configurations/operations.ts @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + Configuration, + ConfigurationForUpdate, + _ConfigurationList, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + configurationDeserializer, + configurationForUpdateSerializer, + _configurationListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + ConfigurationsListByServerOptionalParams, + ConfigurationsUpdateOptionalParams, + ConfigurationsPutOptionalParams, + ConfigurationsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: ConfigurationsListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_ConfigurationList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _configurationListDeserializer(result.body); +} + +/** Lists all configurations (also known as server parameters) of a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: ConfigurationsListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options: ConfigurationsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: configurationForUpdateSerializer(parameters), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return configurationDeserializer(result.body); +} + +/** Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. */ +export function update( + context: Client, + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options: ConfigurationsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Configuration> { + return getLongRunningPoller(context, _updateDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend(context, resourceGroupName, serverName, configurationName, parameters, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, Configuration>; +} + +export function _putSend( + context: Client, + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options: ConfigurationsPutOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: configurationForUpdateSerializer(parameters), + }); +} + +export async function _putDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return configurationDeserializer(result.body); +} + +/** Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. */ +export function put( + context: Client, + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options: ConfigurationsPutOptionalParams = { requestOptions: {} }, +): PollerLike, Configuration> { + return getLongRunningPoller(context, _putDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _putSend(context, resourceGroupName, serverName, configurationName, parameters, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, Configuration>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + configurationName: string, + options: ConfigurationsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + configurationName: configurationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return configurationDeserializer(result.body); +} + +/** Gets information about a specific configuration (also known as server parameter) of a server. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + configurationName: string, + options: ConfigurationsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, configurationName, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/configurations/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/configurations/options.ts new file mode 100644 index 000000000000..31953c649e03 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/configurations/options.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ConfigurationsListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ConfigurationsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ConfigurationsPutOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ConfigurationsGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/databases/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/databases/index.ts new file mode 100644 index 000000000000..a94f142f559a --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/databases/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, $delete, create, get } from "./operations.js"; +export type { + DatabasesListByServerOptionalParams, + DatabasesDeleteOptionalParams, + DatabasesCreateOptionalParams, + DatabasesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/databases/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/databases/operations.ts new file mode 100644 index 000000000000..01f682de2e71 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/databases/operations.ts @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { Database, _DatabaseList } from "../../models/models.js"; +import { + errorResponseDeserializer, + databaseSerializer, + databaseDeserializer, + _databaseListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + DatabasesListByServerOptionalParams, + DatabasesDeleteOptionalParams, + DatabasesCreateOptionalParams, + DatabasesGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: DatabasesListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_DatabaseList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _databaseListDeserializer(result.body); +} + +/** Lists all databases in a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: DatabasesListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + serverName: string, + databaseName: string, + options: DatabasesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + databaseName: databaseName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Deletes an existing database. */ +/** + * @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, + serverName: string, + databaseName: string, + options: DatabasesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, serverName, databaseName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + serverName: string, + databaseName: string, + parameters: Database, + options: DatabasesCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + databaseName: databaseName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: databaseSerializer(parameters), + }); +} + +export async function _createDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return databaseDeserializer(result.body); +} + +/** Creates a new database. */ +export function create( + context: Client, + resourceGroupName: string, + serverName: string, + databaseName: string, + parameters: Database, + options: DatabasesCreateOptionalParams = { requestOptions: {} }, +): PollerLike, Database> { + return getLongRunningPoller(context, _createDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend(context, resourceGroupName, serverName, databaseName, parameters, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, Database>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + databaseName: string, + options: DatabasesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + databaseName: databaseName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return databaseDeserializer(result.body); +} + +/** Gets information about an existing database. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + databaseName: string, + options: DatabasesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, databaseName, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/databases/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/databases/options.ts new file mode 100644 index 000000000000..37e2ff7718c1 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/databases/options.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DatabasesListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DatabasesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DatabasesCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DatabasesGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/firewallRules/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/firewallRules/index.ts new file mode 100644 index 000000000000..c94e9c8a6bf5 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/firewallRules/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, $delete, createOrUpdate, get } from "./operations.js"; +export type { + FirewallRulesListByServerOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/firewallRules/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/firewallRules/operations.ts new file mode 100644 index 000000000000..8361cbadf857 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/firewallRules/operations.ts @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { FirewallRule, _FirewallRuleList } from "../../models/models.js"; +import { + errorResponseDeserializer, + firewallRuleSerializer, + firewallRuleDeserializer, + _firewallRuleListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + FirewallRulesListByServerOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: FirewallRulesListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_FirewallRuleList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _firewallRuleListDeserializer(result.body); +} + +/** Lists information about all firewall rules in a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: FirewallRulesListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options: FirewallRulesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + firewallRuleName: firewallRuleName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Deletes an existing firewall rule. */ +/** + * @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, + serverName: string, + firewallRuleName: string, + options: FirewallRulesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, serverName, firewallRuleName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + parameters: FirewallRule, + options: FirewallRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + firewallRuleName: firewallRuleName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: firewallRuleSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return firewallRuleDeserializer(result.body); +} + +/** Creates a new firewall rule or updates an existing firewall rule. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + parameters: FirewallRule, + options: FirewallRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, FirewallRule> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + serverName, + firewallRuleName, + parameters, + options, + ), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, FirewallRule>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options: FirewallRulesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + firewallRuleName: firewallRuleName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return firewallRuleDeserializer(result.body); +} + +/** Gets information about a firewall rule in a server. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options: FirewallRulesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, firewallRuleName, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/firewallRules/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/firewallRules/options.ts new file mode 100644 index 000000000000..6454439ef8ab --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/firewallRules/options.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface FirewallRulesListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface FirewallRulesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface FirewallRulesGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/index.ts new file mode 100644 index 000000000000..829a8967dbcf --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { + PostgreSQLManagementFlexibleServerContext, + PostgreSQLManagementFlexibleServerClientOptionalParams, +} from "./postgreSQLManagementFlexibleServerContext.js"; +export { createPostgreSQLManagementFlexibleServer } from "./postgreSQLManagementFlexibleServerContext.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/migrations/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/migrations/index.ts new file mode 100644 index 000000000000..e1922f337cc5 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/migrations/index.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + checkNameAvailability, + listByTargetServer, + cancel, + update, + create, + get, +} from "./operations.js"; +export type { + MigrationsCheckNameAvailabilityOptionalParams, + MigrationsListByTargetServerOptionalParams, + MigrationsCancelOptionalParams, + MigrationsUpdateOptionalParams, + MigrationsCreateOptionalParams, + MigrationsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/migrations/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/migrations/operations.ts new file mode 100644 index 000000000000..037c3eecdfa9 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/migrations/operations.ts @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + Migration, + MigrationResourceForPatch, + _MigrationList, + MigrationNameAvailability, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + migrationSerializer, + migrationDeserializer, + migrationResourceForPatchSerializer, + _migrationListDeserializer, + migrationNameAvailabilitySerializer, + migrationNameAvailabilityDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + MigrationsCheckNameAvailabilityOptionalParams, + MigrationsListByTargetServerOptionalParams, + MigrationsCancelOptionalParams, + MigrationsUpdateOptionalParams, + MigrationsCreateOptionalParams, + MigrationsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _checkNameAvailabilitySend( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: MigrationNameAvailability, + options: MigrationsCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/checkMigrationNameAvailability{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: migrationNameAvailabilitySerializer(parameters), + }); +} + +export async function _checkNameAvailabilityDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return migrationNameAvailabilityDeserializer(result.body); +} + +/** Checks if a proposed migration name is valid and available. */ +export async function checkNameAvailability( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: MigrationNameAvailability, + options: MigrationsCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _checkNameAvailabilitySend( + context, + resourceGroupName, + serverName, + parameters, + options, + ); + return _checkNameAvailabilityDeserialize(result); +} + +export function _listByTargetServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: MigrationsListByTargetServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations{?api%2Dversion,migrationListFilter}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + migrationListFilter: options?.migrationListFilter, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByTargetServerDeserialize( + result: PathUncheckedResponse, +): Promise<_MigrationList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _migrationListDeserializer(result.body); +} + +/** Lists all migrations of a target flexible server. */ +export function listByTargetServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: MigrationsListByTargetServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByTargetServerSend(context, resourceGroupName, serverName, options), + _listByTargetServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _cancelSend( + context: Client, + resourceGroupName: string, + serverName: string, + migrationName: string, + options: MigrationsCancelOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + migrationName: migrationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _cancelDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return migrationDeserializer(result.body); +} + +/** Cancels an active migration. */ +export async function cancel( + context: Client, + resourceGroupName: string, + serverName: string, + migrationName: string, + options: MigrationsCancelOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _cancelSend(context, resourceGroupName, serverName, migrationName, options); + return _cancelDeserialize(result); +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + serverName: string, + migrationName: string, + parameters: MigrationResourceForPatch, + options: MigrationsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + migrationName: migrationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: migrationResourceForPatchSerializer(parameters), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return migrationDeserializer(result.body); +} + +/** Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. */ +export async function update( + context: Client, + resourceGroupName: string, + serverName: string, + migrationName: string, + parameters: MigrationResourceForPatch, + options: MigrationsUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateSend( + context, + resourceGroupName, + serverName, + migrationName, + parameters, + options, + ); + return _updateDeserialize(result); +} + +export function _createSend( + context: Client, + resourceGroupName: string, + serverName: string, + migrationName: string, + parameters: Migration, + options: MigrationsCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + migrationName: migrationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: migrationSerializer(parameters), + }); +} + +export async function _createDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return migrationDeserializer(result.body); +} + +/** Creates a new migration. */ +export async function create( + context: Client, + resourceGroupName: string, + serverName: string, + migrationName: string, + parameters: Migration, + options: MigrationsCreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSend( + context, + resourceGroupName, + serverName, + migrationName, + parameters, + options, + ); + return _createDeserialize(result); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + migrationName: string, + options: MigrationsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + migrationName: migrationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return migrationDeserializer(result.body); +} + +/** Gets information about a migration. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + migrationName: string, + options: MigrationsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, migrationName, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/migrations/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/migrations/options.ts new file mode 100644 index 000000000000..95fbdc8816ab --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/migrations/options.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { MigrationListFilter } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface MigrationsCheckNameAvailabilityOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface MigrationsListByTargetServerOptionalParams extends OperationOptions { + /** Migration list filter. Indicates if the request should retrieve only active migrations or all migrations. Defaults to Active. */ + migrationListFilter?: MigrationListFilter; +} + +/** Optional parameters. */ +export interface MigrationsCancelOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface MigrationsUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface MigrationsCreateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface MigrationsGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/nameAvailability/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/nameAvailability/index.ts new file mode 100644 index 000000000000..42b08b4c8620 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/nameAvailability/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { checkWithLocation, checkGlobally } from "./operations.js"; +export type { + NameAvailabilityCheckWithLocationOptionalParams, + NameAvailabilityCheckGloballyOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/nameAvailability/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/nameAvailability/operations.ts new file mode 100644 index 000000000000..9abc9aaa98aa --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/nameAvailability/operations.ts @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { CheckNameAvailabilityRequest, NameAvailabilityModel } from "../../models/models.js"; +import { + errorResponseDeserializer, + checkNameAvailabilityRequestSerializer, + nameAvailabilityModelDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + NameAvailabilityCheckWithLocationOptionalParams, + NameAvailabilityCheckGloballyOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _checkWithLocationSend( + context: Client, + locationName: string, + parameters: CheckNameAvailabilityRequest, + options: NameAvailabilityCheckWithLocationOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + locationName: locationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: checkNameAvailabilityRequestSerializer(parameters), + }); +} + +export async function _checkWithLocationDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return nameAvailabilityModelDeserializer(result.body); +} + +/** Check the availability of name for resource */ +export async function checkWithLocation( + context: Client, + locationName: string, + parameters: CheckNameAvailabilityRequest, + options: NameAvailabilityCheckWithLocationOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _checkWithLocationSend(context, locationName, parameters, options); + return _checkWithLocationDeserialize(result); +} + +export function _checkGloballySend( + context: Client, + parameters: CheckNameAvailabilityRequest, + options: NameAvailabilityCheckGloballyOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: checkNameAvailabilityRequestSerializer(parameters), + }); +} + +export async function _checkGloballyDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return nameAvailabilityModelDeserializer(result.body); +} + +/** Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. */ +export async function checkGlobally( + context: Client, + parameters: CheckNameAvailabilityRequest, + options: NameAvailabilityCheckGloballyOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _checkGloballySend(context, parameters, options); + return _checkGloballyDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/nameAvailability/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/nameAvailability/options.ts new file mode 100644 index 000000000000..154787ac572e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/nameAvailability/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface NameAvailabilityCheckWithLocationOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface NameAvailabilityCheckGloballyOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/operations/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/operations/index.ts new file mode 100644 index 000000000000..de883c05d2f1 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/operations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export type { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/operations/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/operations/operations.ts new file mode 100644 index 000000000000..8c95f21849e3 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/operations/operations.ts @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { _OperationList, Operation } from "../../models/models.js"; +import { _operationListDeserializer, errorResponseDeserializer } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { OperationsListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.DBforPostgreSQL/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + 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<_OperationList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _operationListDeserializer(result.body); +} + +/** Lists all available REST API operations. */ +export function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/operations/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/operations/options.ts new file mode 100644 index 000000000000..b9a3fd9758a3 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/operations/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/postgreSQLManagementFlexibleServerContext.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/postgreSQLManagementFlexibleServerContext.ts new file mode 100644 index 000000000000..f7c5bddd4928 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/postgreSQLManagementFlexibleServerContext.ts @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import type { AzureSupportedClouds } from "../static-helpers/cloudSettingHelpers.js"; +import { getArmEndpoint } from "../static-helpers/cloudSettingHelpers.js"; +import type { Client, ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import type { TokenCredential } from "@azure/core-auth"; + +/** The Azure Database for PostgreSQL management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, network configuration, security alert policies, log files and configurations with new business model. */ +export interface PostgreSQLManagementFlexibleServerContext extends Client { + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Optional parameters for the client. */ +export interface PostgreSQLManagementFlexibleServerClientOptionalParams 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; +} + +/** The Azure Database for PostgreSQL management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, network configuration, security alert policies, log files and configurations with new business model. */ +export function createPostgreSQLManagementFlexibleServer( + credential: TokenCredential, + subscriptionId: string, + options: PostgreSQLManagementFlexibleServerClientOptionalParams = {}, +): PostgreSQLManagementFlexibleServerContext { + const endpointUrl = + options.endpoint ?? getArmEndpoint(options.cloudSetting) ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-postgresql-flexible/10.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); + const apiVersion = options.apiVersion; + return { + ...clientContext, + apiVersion, + subscriptionId, + } as PostgreSQLManagementFlexibleServerContext; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/privateDnsZoneSuffix/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/privateDnsZoneSuffix/index.ts new file mode 100644 index 000000000000..bae151dacccb --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/privateDnsZoneSuffix/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { get } from "./operations.js"; +export type { PrivateDnsZoneSuffixGetOptionalParams } from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/privateDnsZoneSuffix/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/privateDnsZoneSuffix/operations.ts new file mode 100644 index 000000000000..af51b7564b03 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/privateDnsZoneSuffix/operations.ts @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { PrivateDnsZoneSuffixGetResponse } from "../../models/models.js"; +import { errorResponseDeserializer } from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { PrivateDnsZoneSuffixGetOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _getSend( + context: Client, + options: PrivateDnsZoneSuffixGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return { body: result.body }; +} + +/** Gets the private DNS zone suffix. */ +export async function get( + context: Client, + options: PrivateDnsZoneSuffixGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/privateDnsZoneSuffix/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/privateDnsZoneSuffix/options.ts new file mode 100644 index 000000000000..e2e254cb1fee --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/privateDnsZoneSuffix/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface PrivateDnsZoneSuffixGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/privateEndpointConnections/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/privateEndpointConnections/index.ts new file mode 100644 index 000000000000..a81be88f1f37 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/privateEndpointConnections/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, $delete, update, get } from "./operations.js"; +export type { + PrivateEndpointConnectionsListByServerOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsUpdateOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/privateEndpointConnections/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/privateEndpointConnections/operations.ts new file mode 100644 index 000000000000..1dadd8ac8320 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/privateEndpointConnections/operations.ts @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + PrivateEndpointConnection, + _PrivateEndpointConnectionList, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + privateEndpointConnectionSerializer, + privateEndpointConnectionDeserializer, + _privateEndpointConnectionListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + PrivateEndpointConnectionsListByServerOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsUpdateOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: PrivateEndpointConnectionsListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_PrivateEndpointConnectionList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _privateEndpointConnectionListDeserializer(result.body); +} + +/** Lists all private endpoint connections on a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: PrivateEndpointConnectionsListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + privateEndpointConnectionName: privateEndpointConnectionName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Deletes a private endpoint connection. */ +/** + * @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, + serverName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, serverName, privateEndpointConnectionName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + parameters: PrivateEndpointConnection, + options: PrivateEndpointConnectionsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + privateEndpointConnectionName: privateEndpointConnectionName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: privateEndpointConnectionSerializer(parameters), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return privateEndpointConnectionDeserializer(result.body); +} + +/** Approves or rejects a private endpoint connection. */ +export function update( + context: Client, + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + parameters: PrivateEndpointConnection, + options: PrivateEndpointConnectionsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, PrivateEndpointConnection> { + return getLongRunningPoller(context, _updateDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend( + context, + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + options, + ), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, PrivateEndpointConnection>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + privateEndpointConnectionName: privateEndpointConnectionName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return privateEndpointConnectionDeserializer(result.body); +} + +/** Gets a private endpoint connection. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + serverName, + privateEndpointConnectionName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/privateEndpointConnections/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/privateEndpointConnections/options.ts new file mode 100644 index 000000000000..65783eb17794 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/privateEndpointConnections/options.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/privateLinkResources/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/privateLinkResources/index.ts new file mode 100644 index 000000000000..77854945d3fe --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/privateLinkResources/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, get } from "./operations.js"; +export type { + PrivateLinkResourcesListByServerOptionalParams, + PrivateLinkResourcesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/privateLinkResources/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/privateLinkResources/operations.ts new file mode 100644 index 000000000000..c2694c54fae1 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/privateLinkResources/operations.ts @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { PrivateLinkResource, _PrivateLinkResourceList } from "../../models/models.js"; +import { + errorResponseDeserializer, + privateLinkResourceDeserializer, + _privateLinkResourceListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + PrivateLinkResourcesListByServerOptionalParams, + PrivateLinkResourcesGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: PrivateLinkResourcesListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_PrivateLinkResourceList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _privateLinkResourceListDeserializer(result.body); +} + +/** Gets the private link resources for PostgreSQL server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: PrivateLinkResourcesListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + groupName: string, + options: PrivateLinkResourcesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources/{groupName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + groupName: groupName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return privateLinkResourceDeserializer(result.body); +} + +/** Gets a private link resource for PostgreSQL server. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + groupName: string, + options: PrivateLinkResourcesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, groupName, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/privateLinkResources/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/privateLinkResources/options.ts new file mode 100644 index 000000000000..31ccec67d75b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/privateLinkResources/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface PrivateLinkResourcesListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface PrivateLinkResourcesGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/quotaUsages/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/quotaUsages/index.ts new file mode 100644 index 000000000000..d1ee0f23768b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/quotaUsages/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export type { QuotaUsagesListOptionalParams } from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/quotaUsages/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/quotaUsages/operations.ts new file mode 100644 index 000000000000..aa8b0ba7499b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/quotaUsages/operations.ts @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { _QuotaUsageList, QuotaUsage } from "../../models/models.js"; +import { errorResponseDeserializer, _quotaUsageListDeserializer } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { QuotaUsagesListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + locationName: string, + options: QuotaUsagesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/resourceType/flexibleServers/usages{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + locationName: locationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + 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<_QuotaUsageList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _quotaUsageListDeserializer(result.body); +} + +/** Get quota usages at specified location in a given subscription. */ +export function list( + context: Client, + locationName: string, + options: QuotaUsagesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, locationName, options), + _listDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/quotaUsages/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/quotaUsages/options.ts new file mode 100644 index 000000000000..59ed77d56342 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/quotaUsages/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface QuotaUsagesListOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/replicas/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/replicas/index.ts new file mode 100644 index 000000000000..f690ecd398de --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/replicas/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer } from "./operations.js"; +export type { ReplicasListByServerOptionalParams } from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/replicas/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/replicas/operations.ts new file mode 100644 index 000000000000..2fcc16039fa9 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/replicas/operations.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { Server, _ServerList } from "../../models/models.js"; +import { errorResponseDeserializer, _serverListDeserializer } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { ReplicasListByServerOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: ReplicasListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/replicas{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_ServerList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _serverListDeserializer(result.body); +} + +/** Lists all read replicas of a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: ReplicasListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/replicas/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/replicas/options.ts new file mode 100644 index 000000000000..5279b6287522 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/replicas/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ReplicasListByServerOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/serverThreatProtectionSettings/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/serverThreatProtectionSettings/index.ts new file mode 100644 index 000000000000..9c79ecbf2550 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/serverThreatProtectionSettings/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { createOrUpdate } from "./operations.js"; +export type { ServerThreatProtectionSettingsCreateOrUpdateOptionalParams } from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/serverThreatProtectionSettings/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/serverThreatProtectionSettings/operations.ts new file mode 100644 index 000000000000..c07f5e480a5a --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/serverThreatProtectionSettings/operations.ts @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + AdvancedThreatProtectionSettingsModel, + ThreatProtectionName, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + advancedThreatProtectionSettingsModelSerializer, + advancedThreatProtectionSettingsModelDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { ServerThreatProtectionSettingsCreateOrUpdateOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + parameters: AdvancedThreatProtectionSettingsModel, + options: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + threatProtectionName: threatProtectionName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: advancedThreatProtectionSettingsModelSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return advancedThreatProtectionSettingsModelDeserializer(result.body); +} + +/** Creates or updates a server's Advanced Threat Protection settings. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + parameters: AdvancedThreatProtectionSettingsModel, + options: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike< + OperationState, + AdvancedThreatProtectionSettingsModel +> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + serverName, + threatProtectionName, + parameters, + options, + ), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike< + OperationState, + AdvancedThreatProtectionSettingsModel + >; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/serverThreatProtectionSettings/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/serverThreatProtectionSettings/options.ts new file mode 100644 index 000000000000..68fc7c9eb9cd --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/serverThreatProtectionSettings/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ServerThreatProtectionSettingsCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/servers/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/servers/index.ts new file mode 100644 index 000000000000..f6515b9b106e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/servers/index.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + migrateNetworkMode, + stop, + start, + restart, + listBySubscription, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export type { + ServersMigrateNetworkModeOptionalParams, + ServersStopOptionalParams, + ServersStartOptionalParams, + ServersRestartOptionalParams, + ServersListBySubscriptionOptionalParams, + ServersListByResourceGroupOptionalParams, + ServersDeleteOptionalParams, + ServersUpdateOptionalParams, + ServersCreateOrUpdateOptionalParams, + ServersGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/servers/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/servers/operations.ts new file mode 100644 index 000000000000..ccff300ffb8e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/servers/operations.ts @@ -0,0 +1,566 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + Server, + ServerForPatch, + _ServerList, + MigrateNetworkStatus, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + serverSerializer, + serverDeserializer, + serverForPatchSerializer, + _serverListDeserializer, + restartParameterSerializer, + migrateNetworkStatusDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + ServersMigrateNetworkModeOptionalParams, + ServersStopOptionalParams, + ServersStartOptionalParams, + ServersRestartOptionalParams, + ServersListBySubscriptionOptionalParams, + ServersListByResourceGroupOptionalParams, + ServersDeleteOptionalParams, + ServersUpdateOptionalParams, + ServersCreateOrUpdateOptionalParams, + ServersGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _migrateNetworkModeSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersMigrateNetworkModeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrateNetwork{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _migrateNetworkModeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return migrateNetworkStatusDeserializer(result.body); +} + +/** Migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. */ +export function migrateNetworkMode( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersMigrateNetworkModeOptionalParams = { requestOptions: {} }, +): PollerLike, MigrateNetworkStatus> { + return getLongRunningPoller(context, _migrateNetworkModeDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _migrateNetworkModeSend(context, resourceGroupName, serverName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, MigrateNetworkStatus>; +} + +export function _stopSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersStopOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _stopDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Stops a server. */ +export function stop( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersStopOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _stopDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _stopSend(context, resourceGroupName, serverName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _startSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersStartOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _startDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Starts a stopped server. */ +export function start( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersStartOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _startDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _startSend(context, resourceGroupName, serverName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _restartSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersRestartOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: !options["parameters"] + ? options["parameters"] + : restartParameterSerializer(options["parameters"]), + }); +} + +export async function _restartDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Restarts PostgreSQL database engine in a server. */ +export function restart( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersRestartOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _restartDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _restartSend(context, resourceGroupName, serverName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _listBySubscriptionSend( + context: Client, + options: ServersListBySubscriptionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_ServerList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _serverListDeserializer(result.body); +} + +/** Lists all servers in a subscription. */ +export function listBySubscription( + context: Client, + options: ServersListBySubscriptionOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySubscriptionSend(context, options), + _listBySubscriptionDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: ServersListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + 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<_ServerList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _serverListDeserializer(result.body); +} + +/** Lists all servers in a resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: ServersListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Deletes or drops an existing server. */ +/** + * @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, + serverName: string, + options: ServersDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _$deleteSend(context, resourceGroupName, serverName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: ServerForPatch, + options: ServersUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: serverForPatchSerializer(parameters), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return serverDeserializer(result.body); +} + +/** Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. */ +export function update( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: ServerForPatch, + options: ServersUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Server> { + return getLongRunningPoller(context, _updateDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend(context, resourceGroupName, serverName, parameters, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, Server>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: Server, + options: ServersCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: serverSerializer(parameters), + }); +} + +export async function _createOrUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return serverDeserializer(result.body); +} + +/** Creates a new server. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + serverName: string, + parameters: Server, + options: ServersCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Server> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, serverName, parameters, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, Server>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return serverDeserializer(result.body); +} + +/** Gets information about an existing server. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + options: ServersGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/servers/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/servers/options.ts new file mode 100644 index 000000000000..ef35512d028b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/servers/options.ts @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { RestartParameter } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ServersMigrateNetworkModeOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ServersStopOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ServersStartOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ServersRestartOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** Parameters to restart a server. */ + parameters?: RestartParameter; +} + +/** Optional parameters. */ +export interface ServersListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ServersListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ServersDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ServersUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ServersCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ServersGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/tuningOptions/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/tuningOptions/index.ts new file mode 100644 index 000000000000..07e8b9cf62cf --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/tuningOptions/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listRecommendations, listByServer, get } from "./operations.js"; +export type { + TuningOptionsListRecommendationsOptionalParams, + TuningOptionsListByServerOptionalParams, + TuningOptionsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/tuningOptions/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/tuningOptions/operations.ts new file mode 100644 index 000000000000..825bac14b322 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/tuningOptions/operations.ts @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + TuningOptions, + TuningOptionParameterEnum, + _TuningOptionsList, + _ObjectRecommendationList, + ObjectRecommendation, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + tuningOptionsDeserializer, + _tuningOptionsListDeserializer, + _objectRecommendationListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + TuningOptionsListRecommendationsOptionalParams, + TuningOptionsListByServerOptionalParams, + TuningOptionsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listRecommendationsSend( + context: Client, + resourceGroupName: string, + serverName: string, + tuningOption: TuningOptionParameterEnum, + options: TuningOptionsListRecommendationsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations{?api%2Dversion,recommendationType}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + tuningOption: tuningOption, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + recommendationType: options?.recommendationType, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listRecommendationsDeserialize( + result: PathUncheckedResponse, +): Promise<_ObjectRecommendationList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _objectRecommendationListDeserializer(result.body); +} + +/** Lists available object recommendations. */ +export function listRecommendations( + context: Client, + resourceGroupName: string, + serverName: string, + tuningOption: TuningOptionParameterEnum, + options: TuningOptionsListRecommendationsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listRecommendationsSend(context, resourceGroupName, serverName, tuningOption, options), + _listRecommendationsDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: TuningOptionsListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_TuningOptionsList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _tuningOptionsListDeserializer(result.body); +} + +/** Lists the tuning options of a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: TuningOptionsListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + tuningOption: TuningOptionParameterEnum, + options: TuningOptionsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + tuningOption: tuningOption, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return tuningOptionsDeserializer(result.body); +} + +/** Gets the tuning options of a server. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + tuningOption: TuningOptionParameterEnum, + options: TuningOptionsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, serverName, tuningOption, options); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/tuningOptions/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/tuningOptions/options.ts new file mode 100644 index 000000000000..1bc05536424f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/tuningOptions/options.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { RecommendationTypeParameterEnum } from "../../models/models.js"; +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface TuningOptionsListRecommendationsOptionalParams extends OperationOptions { + /** Recommendations list filter. Retrieves recommendations based on type. */ + recommendationType?: RecommendationTypeParameterEnum; +} + +/** Optional parameters. */ +export interface TuningOptionsListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TuningOptionsGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/virtualEndpoints/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualEndpoints/index.ts new file mode 100644 index 000000000000..b489ba440d61 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualEndpoints/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByServer, $delete, update, create, get } from "./operations.js"; +export type { + VirtualEndpointsListByServerOptionalParams, + VirtualEndpointsDeleteOptionalParams, + VirtualEndpointsUpdateOptionalParams, + VirtualEndpointsCreateOptionalParams, + VirtualEndpointsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/virtualEndpoints/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualEndpoints/operations.ts new file mode 100644 index 000000000000..cfda2d9d1aff --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualEndpoints/operations.ts @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + VirtualEndpoint, + VirtualEndpointResourceForPatch, + _VirtualEndpointsList, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + virtualEndpointSerializer, + virtualEndpointDeserializer, + virtualEndpointResourceForPatchSerializer, + _virtualEndpointsListDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + VirtualEndpointsListByServerOptionalParams, + VirtualEndpointsDeleteOptionalParams, + VirtualEndpointsUpdateOptionalParams, + VirtualEndpointsCreateOptionalParams, + VirtualEndpointsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByServerSend( + context: Client, + resourceGroupName: string, + serverName: string, + options: VirtualEndpointsListByServerOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByServerDeserialize( + result: PathUncheckedResponse, +): Promise<_VirtualEndpointsList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return _virtualEndpointsListDeserializer(result.body); +} + +/** Lists pair of virtual endpoints associated to a server. */ +export function listByServer( + context: Client, + resourceGroupName: string, + serverName: string, + options: VirtualEndpointsListByServerOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByServerSend(context, resourceGroupName, serverName, options), + _listByServerDeserialize, + ["200"], + { + itemName: "value", + nextLinkName: "nextLink", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options: VirtualEndpointsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + virtualEndpointName: virtualEndpointName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return; +} + +/** Deletes a pair of virtual endpoints. */ +/** + * @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, + serverName: string, + virtualEndpointName: string, + options: VirtualEndpointsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, serverName, virtualEndpointName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpointResourceForPatch, + options: VirtualEndpointsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + virtualEndpointName: virtualEndpointName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: virtualEndpointResourceForPatchSerializer(parameters), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return virtualEndpointDeserializer(result.body); +} + +/** Updates a pair of virtual endpoints for a server. */ +export function update( + context: Client, + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpointResourceForPatch, + options: VirtualEndpointsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, VirtualEndpoint> { + return getLongRunningPoller(context, _updateDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend(context, resourceGroupName, serverName, virtualEndpointName, parameters, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, VirtualEndpoint>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpoint, + options: VirtualEndpointsCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + virtualEndpointName: virtualEndpointName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: virtualEndpointSerializer(parameters), + }); +} + +export async function _createDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return virtualEndpointDeserializer(result.body); +} + +/** Creates a pair of virtual endpoints for a server. */ +export function create( + context: Client, + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpoint, + options: VirtualEndpointsCreateOptionalParams = { requestOptions: {} }, +): PollerLike, VirtualEndpoint> { + return getLongRunningPoller(context, _createDeserialize, ["202", "200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend(context, resourceGroupName, serverName, virtualEndpointName, parameters, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2026-01-01-preview", + }) as PollerLike, VirtualEndpoint>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options: VirtualEndpointsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + serverName: serverName, + virtualEndpointName: virtualEndpointName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return virtualEndpointDeserializer(result.body); +} + +/** Gets information about a pair of virtual endpoints. */ +export async function get( + context: Client, + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options: VirtualEndpointsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + serverName, + virtualEndpointName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/virtualEndpoints/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualEndpoints/options.ts new file mode 100644 index 000000000000..0818eb4b7ba8 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualEndpoints/options.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface VirtualEndpointsListByServerOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface VirtualEndpointsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface VirtualEndpointsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface VirtualEndpointsCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface VirtualEndpointsGetOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/virtualNetworkSubnetUsage/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualNetworkSubnetUsage/index.ts new file mode 100644 index 000000000000..60abfc7afbbc --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualNetworkSubnetUsage/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export type { VirtualNetworkSubnetUsageListOptionalParams } from "./options.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/virtualNetworkSubnetUsage/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualNetworkSubnetUsage/operations.ts new file mode 100644 index 000000000000..ee19ee8d7df7 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualNetworkSubnetUsage/operations.ts @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext as Client } from "../index.js"; +import type { + VirtualNetworkSubnetUsageParameter, + VirtualNetworkSubnetUsageModel, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + virtualNetworkSubnetUsageParameterSerializer, + virtualNetworkSubnetUsageModelDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { VirtualNetworkSubnetUsageListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + locationName: string, + parameters: VirtualNetworkSubnetUsageParameter, + options: VirtualNetworkSubnetUsageListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + locationName: locationName, + "api%2Dversion": context.apiVersion ?? "2026-01-01-preview", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: virtualNetworkSubnetUsageParameterSerializer(parameters), + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + + throw error; + } + + return virtualNetworkSubnetUsageModelDeserializer(result.body); +} + +/** Lists the virtual network subnet usage for a given virtual network. */ +export async function list( + context: Client, + locationName: string, + parameters: VirtualNetworkSubnetUsageParameter, + options: VirtualNetworkSubnetUsageListOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _listSend(context, locationName, parameters, options); + return _listDeserialize(result); +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/api/virtualNetworkSubnetUsage/options.ts b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualNetworkSubnetUsage/options.ts new file mode 100644 index 000000000000..f01368ffe55b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/api/virtualNetworkSubnetUsage/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface VirtualNetworkSubnetUsageListOptionalParams extends OperationOptions {} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/administratorsMicrosoftEntra/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/administratorsMicrosoftEntra/index.ts new file mode 100644 index 000000000000..89921f950230 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/administratorsMicrosoftEntra/index.ts @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { + listByServer, + $delete, + createOrUpdate, + get, +} from "../../api/administratorsMicrosoftEntra/operations.js"; +import type { + AdministratorsMicrosoftEntraListByServerOptionalParams, + AdministratorsMicrosoftEntraDeleteOptionalParams, + AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + AdministratorsMicrosoftEntraGetOptionalParams, +} from "../../api/administratorsMicrosoftEntra/options.js"; +import type { + AdministratorMicrosoftEntra, + AdministratorMicrosoftEntraAdd, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a AdministratorsMicrosoftEntra operations. */ +export interface AdministratorsMicrosoftEntraOperations { + /** List all server administrators associated to a Microsoft Entra principal. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: AdministratorsMicrosoftEntraListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes an existing server administrator associated to a Microsoft Entra principal. */ + /** + * @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, + serverName: string, + objectId: string, + options?: AdministratorsMicrosoftEntraDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + serverName: string, + objectId: string, + options?: AdministratorsMicrosoftEntraDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + serverName: string, + objectId: string, + options?: AdministratorsMicrosoftEntraDeleteOptionalParams, + ) => Promise; + /** Creates a new server administrator associated to a Microsoft Entra principal. */ + createOrUpdate: ( + resourceGroupName: string, + serverName: string, + objectId: string, + parameters: AdministratorMicrosoftEntraAdd, + options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + ) => PollerLike, AdministratorMicrosoftEntra>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + serverName: string, + objectId: string, + parameters: AdministratorMicrosoftEntraAdd, + options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + ) => Promise< + SimplePollerLike, AdministratorMicrosoftEntra> + >; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + serverName: string, + objectId: string, + parameters: AdministratorMicrosoftEntraAdd, + options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + ) => Promise; + /** Gets information about a server administrator associated to a Microsoft Entra principal. */ + get: ( + resourceGroupName: string, + serverName: string, + objectId: string, + options?: AdministratorsMicrosoftEntraGetOptionalParams, + ) => Promise; +} + +function _getAdministratorsMicrosoftEntra(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: AdministratorsMicrosoftEntraListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + delete: ( + resourceGroupName: string, + serverName: string, + objectId: string, + options?: AdministratorsMicrosoftEntraDeleteOptionalParams, + ) => $delete(context, resourceGroupName, serverName, objectId, options), + beginDelete: async ( + resourceGroupName: string, + serverName: string, + objectId: string, + options?: AdministratorsMicrosoftEntraDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, serverName, objectId, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + serverName: string, + objectId: string, + options?: AdministratorsMicrosoftEntraDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, serverName, objectId, options); + }, + createOrUpdate: ( + resourceGroupName: string, + serverName: string, + objectId: string, + parameters: AdministratorMicrosoftEntraAdd, + options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, serverName, objectId, parameters, options), + beginCreateOrUpdate: async ( + resourceGroupName: string, + serverName: string, + objectId: string, + parameters: AdministratorMicrosoftEntraAdd, + options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + serverName, + objectId, + parameters, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + serverName: string, + objectId: string, + parameters: AdministratorMicrosoftEntraAdd, + options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + serverName, + objectId, + parameters, + options, + ); + }, + get: ( + resourceGroupName: string, + serverName: string, + objectId: string, + options?: AdministratorsMicrosoftEntraGetOptionalParams, + ) => get(context, resourceGroupName, serverName, objectId, options), + }; +} + +export function _getAdministratorsMicrosoftEntraOperations( + context: PostgreSQLManagementFlexibleServerContext, +): AdministratorsMicrosoftEntraOperations { + return { + ..._getAdministratorsMicrosoftEntra(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/advancedThreatProtectionSettings/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/advancedThreatProtectionSettings/index.ts new file mode 100644 index 000000000000..2fa9423960f7 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/advancedThreatProtectionSettings/index.ts @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { listByServer, get } from "../../api/advancedThreatProtectionSettings/operations.js"; +import type { + AdvancedThreatProtectionSettingsListByServerOptionalParams, + AdvancedThreatProtectionSettingsGetOptionalParams, +} from "../../api/advancedThreatProtectionSettings/options.js"; +import type { + AdvancedThreatProtectionSettingsModel, + ThreatProtectionName, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a AdvancedThreatProtectionSettings operations. */ +export interface AdvancedThreatProtectionSettingsOperations { + /** Lists state of advanced threat protection settings for a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: AdvancedThreatProtectionSettingsListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Gets state of advanced threat protection settings for a server. */ + get: ( + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + options?: AdvancedThreatProtectionSettingsGetOptionalParams, + ) => Promise; +} + +function _getAdvancedThreatProtectionSettings(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: AdvancedThreatProtectionSettingsListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + get: ( + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + options?: AdvancedThreatProtectionSettingsGetOptionalParams, + ) => get(context, resourceGroupName, serverName, threatProtectionName, options), + }; +} + +export function _getAdvancedThreatProtectionSettingsOperations( + context: PostgreSQLManagementFlexibleServerContext, +): AdvancedThreatProtectionSettingsOperations { + return { + ..._getAdvancedThreatProtectionSettings(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/backupsAutomaticAndOnDemand/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/backupsAutomaticAndOnDemand/index.ts new file mode 100644 index 000000000000..448ab994728f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/backupsAutomaticAndOnDemand/index.ts @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { + listByServer, + $delete, + create, + get, +} from "../../api/backupsAutomaticAndOnDemand/operations.js"; +import type { + BackupsAutomaticAndOnDemandListByServerOptionalParams, + BackupsAutomaticAndOnDemandDeleteOptionalParams, + BackupsAutomaticAndOnDemandCreateOptionalParams, + BackupsAutomaticAndOnDemandGetOptionalParams, +} from "../../api/backupsAutomaticAndOnDemand/options.js"; +import type { BackupAutomaticAndOnDemand } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a BackupsAutomaticAndOnDemand operations. */ +export interface BackupsAutomaticAndOnDemandOperations { + /** Lists all available backups of a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: BackupsAutomaticAndOnDemandListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes a specific backup, given its name. */ + /** + * @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, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, + ) => Promise; + /** Creates an on demand backup of a server. */ + create: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandCreateOptionalParams, + ) => PollerLike, BackupAutomaticAndOnDemand>; + /** @deprecated use create instead */ + beginCreate: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandCreateOptionalParams, + ) => Promise< + SimplePollerLike, BackupAutomaticAndOnDemand> + >; + /** @deprecated use create instead */ + beginCreateAndWait: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandCreateOptionalParams, + ) => Promise; + /** Gets information of an on demand backup, given its name. */ + get: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandGetOptionalParams, + ) => Promise; +} + +function _getBackupsAutomaticAndOnDemand(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: BackupsAutomaticAndOnDemandListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + delete: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, + ) => $delete(context, resourceGroupName, serverName, backupName, options), + beginDelete: async ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, serverName, backupName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, serverName, backupName, options); + }, + create: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandCreateOptionalParams, + ) => create(context, resourceGroupName, serverName, backupName, options), + beginCreate: async ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandCreateOptionalParams, + ) => { + const poller = create(context, resourceGroupName, serverName, backupName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateAndWait: async ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandCreateOptionalParams, + ) => { + return await create(context, resourceGroupName, serverName, backupName, options); + }, + get: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsAutomaticAndOnDemandGetOptionalParams, + ) => get(context, resourceGroupName, serverName, backupName, options), + }; +} + +export function _getBackupsAutomaticAndOnDemandOperations( + context: PostgreSQLManagementFlexibleServerContext, +): BackupsAutomaticAndOnDemandOperations { + return { + ..._getBackupsAutomaticAndOnDemand(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/backupsLongTermRetention/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/backupsLongTermRetention/index.ts new file mode 100644 index 000000000000..917838e4eb08 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/backupsLongTermRetention/index.ts @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { + listByServer, + get, + start, + checkPrerequisites, +} from "../../api/backupsLongTermRetention/operations.js"; +import type { + BackupsLongTermRetentionListByServerOptionalParams, + BackupsLongTermRetentionGetOptionalParams, + BackupsLongTermRetentionStartOptionalParams, + BackupsLongTermRetentionCheckPrerequisitesOptionalParams, +} from "../../api/backupsLongTermRetention/options.js"; +import type { + LtrPreBackupRequest, + LtrPreBackupResponse, + BackupsLongTermRetentionRequest, + BackupsLongTermRetentionResponse, + BackupsLongTermRetentionOperation, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a BackupsLongTermRetention operations. */ +export interface BackupsLongTermRetentionOperations { + /** Lists the results of the long term retention backup operations for a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: BackupsLongTermRetentionListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Gets the results of a long retention backup operation for a server. */ + get: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsLongTermRetentionGetOptionalParams, + ) => Promise; + /** Initiates a long term retention backup. */ + start: ( + resourceGroupName: string, + serverName: string, + parameters: BackupsLongTermRetentionRequest, + options?: BackupsLongTermRetentionStartOptionalParams, + ) => PollerLike< + OperationState, + BackupsLongTermRetentionResponse + >; + /** @deprecated use start instead */ + beginStart: ( + resourceGroupName: string, + serverName: string, + parameters: BackupsLongTermRetentionRequest, + options?: BackupsLongTermRetentionStartOptionalParams, + ) => Promise< + SimplePollerLike< + OperationState, + BackupsLongTermRetentionResponse + > + >; + /** @deprecated use start instead */ + beginStartAndWait: ( + resourceGroupName: string, + serverName: string, + parameters: BackupsLongTermRetentionRequest, + options?: BackupsLongTermRetentionStartOptionalParams, + ) => Promise; + /** Performs all checks required for a long term retention backup operation to succeed. */ + checkPrerequisites: ( + resourceGroupName: string, + serverName: string, + parameters: LtrPreBackupRequest, + options?: BackupsLongTermRetentionCheckPrerequisitesOptionalParams, + ) => Promise; +} + +function _getBackupsLongTermRetention(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: BackupsLongTermRetentionListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + get: ( + resourceGroupName: string, + serverName: string, + backupName: string, + options?: BackupsLongTermRetentionGetOptionalParams, + ) => get(context, resourceGroupName, serverName, backupName, options), + start: ( + resourceGroupName: string, + serverName: string, + parameters: BackupsLongTermRetentionRequest, + options?: BackupsLongTermRetentionStartOptionalParams, + ) => start(context, resourceGroupName, serverName, parameters, options), + beginStart: async ( + resourceGroupName: string, + serverName: string, + parameters: BackupsLongTermRetentionRequest, + options?: BackupsLongTermRetentionStartOptionalParams, + ) => { + const poller = start(context, resourceGroupName, serverName, parameters, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginStartAndWait: async ( + resourceGroupName: string, + serverName: string, + parameters: BackupsLongTermRetentionRequest, + options?: BackupsLongTermRetentionStartOptionalParams, + ) => { + return await start(context, resourceGroupName, serverName, parameters, options); + }, + checkPrerequisites: ( + resourceGroupName: string, + serverName: string, + parameters: LtrPreBackupRequest, + options?: BackupsLongTermRetentionCheckPrerequisitesOptionalParams, + ) => checkPrerequisites(context, resourceGroupName, serverName, parameters, options), + }; +} + +export function _getBackupsLongTermRetentionOperations( + context: PostgreSQLManagementFlexibleServerContext, +): BackupsLongTermRetentionOperations { + return { + ..._getBackupsLongTermRetention(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/capabilitiesByLocation/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/capabilitiesByLocation/index.ts new file mode 100644 index 000000000000..159693b6186a --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/capabilitiesByLocation/index.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { list } from "../../api/capabilitiesByLocation/operations.js"; +import type { CapabilitiesByLocationListOptionalParams } from "../../api/capabilitiesByLocation/options.js"; +import type { Capability } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a CapabilitiesByLocation operations. */ +export interface CapabilitiesByLocationOperations { + /** Lists the capabilities available in a given location for a specific subscription. */ + list: ( + locationName: string, + options?: CapabilitiesByLocationListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getCapabilitiesByLocation(context: PostgreSQLManagementFlexibleServerContext) { + return { + list: (locationName: string, options?: CapabilitiesByLocationListOptionalParams) => + list(context, locationName, options), + }; +} + +export function _getCapabilitiesByLocationOperations( + context: PostgreSQLManagementFlexibleServerContext, +): CapabilitiesByLocationOperations { + return { + ..._getCapabilitiesByLocation(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/capabilitiesByServer/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/capabilitiesByServer/index.ts new file mode 100644 index 000000000000..6353af3dfc6f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/capabilitiesByServer/index.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { list } from "../../api/capabilitiesByServer/operations.js"; +import type { CapabilitiesByServerListOptionalParams } from "../../api/capabilitiesByServer/options.js"; +import type { Capability } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a CapabilitiesByServer operations. */ +export interface CapabilitiesByServerOperations { + /** Lists the capabilities available for a given server. */ + list: ( + resourceGroupName: string, + serverName: string, + options?: CapabilitiesByServerListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getCapabilitiesByServer(context: PostgreSQLManagementFlexibleServerContext) { + return { + list: ( + resourceGroupName: string, + serverName: string, + options?: CapabilitiesByServerListOptionalParams, + ) => list(context, resourceGroupName, serverName, options), + }; +} + +export function _getCapabilitiesByServerOperations( + context: PostgreSQLManagementFlexibleServerContext, +): CapabilitiesByServerOperations { + return { + ..._getCapabilitiesByServer(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/capturedLogs/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/capturedLogs/index.ts new file mode 100644 index 000000000000..791aa1d5df82 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/capturedLogs/index.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { listByServer } from "../../api/capturedLogs/operations.js"; +import type { CapturedLogsListByServerOptionalParams } from "../../api/capturedLogs/options.js"; +import type { CapturedLog } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a CapturedLogs operations. */ +export interface CapturedLogsOperations { + /** Lists all captured logs for download in a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: CapturedLogsListByServerOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getCapturedLogs(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: CapturedLogsListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + }; +} + +export function _getCapturedLogsOperations( + context: PostgreSQLManagementFlexibleServerContext, +): CapturedLogsOperations { + return { + ..._getCapturedLogs(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/configurations/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/configurations/index.ts new file mode 100644 index 000000000000..d34617101111 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/configurations/index.ts @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { listByServer, update, put, get } from "../../api/configurations/operations.js"; +import type { + ConfigurationsListByServerOptionalParams, + ConfigurationsUpdateOptionalParams, + ConfigurationsPutOptionalParams, + ConfigurationsGetOptionalParams, +} from "../../api/configurations/options.js"; +import type { Configuration, ConfigurationForUpdate } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Configurations operations. */ +export interface ConfigurationsOperations { + /** Lists all configurations (also known as server parameters) of a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: ConfigurationsListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Updates the value assigned to a specific modifiable configuration (also known as server parameter) of a server. */ + update: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsUpdateOptionalParams, + ) => PollerLike, Configuration>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsUpdateOptionalParams, + ) => Promise, Configuration>>; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsUpdateOptionalParams, + ) => Promise; + /** Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as server parameter) of a server. */ + put: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsPutOptionalParams, + ) => PollerLike, Configuration>; + /** @deprecated use put instead */ + beginPut: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsPutOptionalParams, + ) => Promise, Configuration>>; + /** @deprecated use put instead */ + beginPutAndWait: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsPutOptionalParams, + ) => Promise; + /** Gets information about a specific configuration (also known as server parameter) of a server. */ + get: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + options?: ConfigurationsGetOptionalParams, + ) => Promise; +} + +function _getConfigurations(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: ConfigurationsListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + update: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsUpdateOptionalParams, + ) => update(context, resourceGroupName, serverName, configurationName, parameters, options), + beginUpdate: async ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsUpdateOptionalParams, + ) => { + const poller = update( + context, + resourceGroupName, + serverName, + configurationName, + parameters, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsUpdateOptionalParams, + ) => { + return await update( + context, + resourceGroupName, + serverName, + configurationName, + parameters, + options, + ); + }, + put: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsPutOptionalParams, + ) => put(context, resourceGroupName, serverName, configurationName, parameters, options), + beginPut: async ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsPutOptionalParams, + ) => { + const poller = put( + context, + resourceGroupName, + serverName, + configurationName, + parameters, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginPutAndWait: async ( + resourceGroupName: string, + serverName: string, + configurationName: string, + parameters: ConfigurationForUpdate, + options?: ConfigurationsPutOptionalParams, + ) => { + return await put( + context, + resourceGroupName, + serverName, + configurationName, + parameters, + options, + ); + }, + get: ( + resourceGroupName: string, + serverName: string, + configurationName: string, + options?: ConfigurationsGetOptionalParams, + ) => get(context, resourceGroupName, serverName, configurationName, options), + }; +} + +export function _getConfigurationsOperations( + context: PostgreSQLManagementFlexibleServerContext, +): ConfigurationsOperations { + return { + ..._getConfigurations(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/databases/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/databases/index.ts new file mode 100644 index 000000000000..a07dd994b6f8 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/databases/index.ts @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { listByServer, $delete, create, get } from "../../api/databases/operations.js"; +import type { + DatabasesListByServerOptionalParams, + DatabasesDeleteOptionalParams, + DatabasesCreateOptionalParams, + DatabasesGetOptionalParams, +} from "../../api/databases/options.js"; +import type { Database } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Databases operations. */ +export interface DatabasesOperations { + /** Lists all databases in a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: DatabasesListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes an existing database. */ + /** + * @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, + serverName: string, + databaseName: string, + options?: DatabasesDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + serverName: string, + databaseName: string, + options?: DatabasesDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + serverName: string, + databaseName: string, + options?: DatabasesDeleteOptionalParams, + ) => Promise; + /** Creates a new database. */ + create: ( + resourceGroupName: string, + serverName: string, + databaseName: string, + parameters: Database, + options?: DatabasesCreateOptionalParams, + ) => PollerLike, Database>; + /** @deprecated use create instead */ + beginCreate: ( + resourceGroupName: string, + serverName: string, + databaseName: string, + parameters: Database, + options?: DatabasesCreateOptionalParams, + ) => Promise, Database>>; + /** @deprecated use create instead */ + beginCreateAndWait: ( + resourceGroupName: string, + serverName: string, + databaseName: string, + parameters: Database, + options?: DatabasesCreateOptionalParams, + ) => Promise; + /** Gets information about an existing database. */ + get: ( + resourceGroupName: string, + serverName: string, + databaseName: string, + options?: DatabasesGetOptionalParams, + ) => Promise; +} + +function _getDatabases(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: DatabasesListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + delete: ( + resourceGroupName: string, + serverName: string, + databaseName: string, + options?: DatabasesDeleteOptionalParams, + ) => $delete(context, resourceGroupName, serverName, databaseName, options), + beginDelete: async ( + resourceGroupName: string, + serverName: string, + databaseName: string, + options?: DatabasesDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, serverName, databaseName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + serverName: string, + databaseName: string, + options?: DatabasesDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, serverName, databaseName, options); + }, + create: ( + resourceGroupName: string, + serverName: string, + databaseName: string, + parameters: Database, + options?: DatabasesCreateOptionalParams, + ) => create(context, resourceGroupName, serverName, databaseName, parameters, options), + beginCreate: async ( + resourceGroupName: string, + serverName: string, + databaseName: string, + parameters: Database, + options?: DatabasesCreateOptionalParams, + ) => { + const poller = create( + context, + resourceGroupName, + serverName, + databaseName, + parameters, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateAndWait: async ( + resourceGroupName: string, + serverName: string, + databaseName: string, + parameters: Database, + options?: DatabasesCreateOptionalParams, + ) => { + return await create( + context, + resourceGroupName, + serverName, + databaseName, + parameters, + options, + ); + }, + get: ( + resourceGroupName: string, + serverName: string, + databaseName: string, + options?: DatabasesGetOptionalParams, + ) => get(context, resourceGroupName, serverName, databaseName, options), + }; +} + +export function _getDatabasesOperations( + context: PostgreSQLManagementFlexibleServerContext, +): DatabasesOperations { + return { + ..._getDatabases(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/firewallRules/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/firewallRules/index.ts new file mode 100644 index 000000000000..d75677855965 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/firewallRules/index.ts @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { listByServer, $delete, createOrUpdate, get } from "../../api/firewallRules/operations.js"; +import type { + FirewallRulesListByServerOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesGetOptionalParams, +} from "../../api/firewallRules/options.js"; +import type { FirewallRule } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a FirewallRules operations. */ +export interface FirewallRulesOperations { + /** Lists information about all firewall rules in a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: FirewallRulesListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes an existing firewall rule. */ + /** + * @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, + serverName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ) => Promise; + /** Creates a new firewall rule or updates an existing firewall rule. */ + createOrUpdate: ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + parameters: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ) => PollerLike, FirewallRule>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + parameters: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ) => Promise, FirewallRule>>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + parameters: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ) => Promise; + /** Gets information about a firewall rule in a server. */ + get: ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options?: FirewallRulesGetOptionalParams, + ) => Promise; +} + +function _getFirewallRules(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: FirewallRulesListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + delete: ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ) => $delete(context, resourceGroupName, serverName, firewallRuleName, options), + beginDelete: async ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, serverName, firewallRuleName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, serverName, firewallRuleName, options); + }, + createOrUpdate: ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + parameters: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ) => + createOrUpdate(context, resourceGroupName, serverName, firewallRuleName, parameters, options), + beginCreateOrUpdate: async ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + parameters: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + serverName, + firewallRuleName, + parameters, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + parameters: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + serverName, + firewallRuleName, + parameters, + options, + ); + }, + get: ( + resourceGroupName: string, + serverName: string, + firewallRuleName: string, + options?: FirewallRulesGetOptionalParams, + ) => get(context, resourceGroupName, serverName, firewallRuleName, options), + }; +} + +export function _getFirewallRulesOperations( + context: PostgreSQLManagementFlexibleServerContext, +): FirewallRulesOperations { + return { + ..._getFirewallRules(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/index.ts new file mode 100644 index 000000000000..1a2f0454b27b --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/index.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export type { AdministratorsMicrosoftEntraOperations } from "./administratorsMicrosoftEntra/index.js"; +export type { AdvancedThreatProtectionSettingsOperations } from "./advancedThreatProtectionSettings/index.js"; +export type { BackupsAutomaticAndOnDemandOperations } from "./backupsAutomaticAndOnDemand/index.js"; +export type { BackupsLongTermRetentionOperations } from "./backupsLongTermRetention/index.js"; +export type { CapabilitiesByLocationOperations } from "./capabilitiesByLocation/index.js"; +export type { CapabilitiesByServerOperations } from "./capabilitiesByServer/index.js"; +export type { CapturedLogsOperations } from "./capturedLogs/index.js"; +export type { ConfigurationsOperations } from "./configurations/index.js"; +export type { DatabasesOperations } from "./databases/index.js"; +export type { FirewallRulesOperations } from "./firewallRules/index.js"; +export type { MigrationsOperations } from "./migrations/index.js"; +export type { NameAvailabilityOperations } from "./nameAvailability/index.js"; +export type { OperationsOperations } from "./operations/index.js"; +export type { PrivateDnsZoneSuffixOperations } from "./privateDnsZoneSuffix/index.js"; +export type { PrivateEndpointConnectionsOperations } from "./privateEndpointConnections/index.js"; +export type { PrivateLinkResourcesOperations } from "./privateLinkResources/index.js"; +export type { QuotaUsagesOperations } from "./quotaUsages/index.js"; +export type { ReplicasOperations } from "./replicas/index.js"; +export type { ServersOperations } from "./servers/index.js"; +export type { ServerThreatProtectionSettingsOperations } from "./serverThreatProtectionSettings/index.js"; +export type { TuningOptionsOperations } from "./tuningOptions/index.js"; +export type { VirtualEndpointsOperations } from "./virtualEndpoints/index.js"; +export type { VirtualNetworkSubnetUsageOperations } from "./virtualNetworkSubnetUsage/index.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/migrations/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/migrations/index.ts new file mode 100644 index 000000000000..1aa29eb845ed --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/migrations/index.ts @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { + checkNameAvailability, + listByTargetServer, + cancel, + update, + create, + get, +} from "../../api/migrations/operations.js"; +import type { + MigrationsCheckNameAvailabilityOptionalParams, + MigrationsListByTargetServerOptionalParams, + MigrationsCancelOptionalParams, + MigrationsUpdateOptionalParams, + MigrationsCreateOptionalParams, + MigrationsGetOptionalParams, +} from "../../api/migrations/options.js"; +import type { + Migration, + MigrationResourceForPatch, + MigrationNameAvailability, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Migrations operations. */ +export interface MigrationsOperations { + /** Checks if a proposed migration name is valid and available. */ + checkNameAvailability: ( + resourceGroupName: string, + serverName: string, + parameters: MigrationNameAvailability, + options?: MigrationsCheckNameAvailabilityOptionalParams, + ) => Promise; + /** Lists all migrations of a target flexible server. */ + listByTargetServer: ( + resourceGroupName: string, + serverName: string, + options?: MigrationsListByTargetServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Cancels an active migration. */ + cancel: ( + resourceGroupName: string, + serverName: string, + migrationName: string, + options?: MigrationsCancelOptionalParams, + ) => Promise; + /** Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. */ + update: ( + resourceGroupName: string, + serverName: string, + migrationName: string, + parameters: MigrationResourceForPatch, + options?: MigrationsUpdateOptionalParams, + ) => Promise; + /** Creates a new migration. */ + create: ( + resourceGroupName: string, + serverName: string, + migrationName: string, + parameters: Migration, + options?: MigrationsCreateOptionalParams, + ) => Promise; + /** Gets information about a migration. */ + get: ( + resourceGroupName: string, + serverName: string, + migrationName: string, + options?: MigrationsGetOptionalParams, + ) => Promise; +} + +function _getMigrations(context: PostgreSQLManagementFlexibleServerContext) { + return { + checkNameAvailability: ( + resourceGroupName: string, + serverName: string, + parameters: MigrationNameAvailability, + options?: MigrationsCheckNameAvailabilityOptionalParams, + ) => checkNameAvailability(context, resourceGroupName, serverName, parameters, options), + listByTargetServer: ( + resourceGroupName: string, + serverName: string, + options?: MigrationsListByTargetServerOptionalParams, + ) => listByTargetServer(context, resourceGroupName, serverName, options), + cancel: ( + resourceGroupName: string, + serverName: string, + migrationName: string, + options?: MigrationsCancelOptionalParams, + ) => cancel(context, resourceGroupName, serverName, migrationName, options), + update: ( + resourceGroupName: string, + serverName: string, + migrationName: string, + parameters: MigrationResourceForPatch, + options?: MigrationsUpdateOptionalParams, + ) => update(context, resourceGroupName, serverName, migrationName, parameters, options), + create: ( + resourceGroupName: string, + serverName: string, + migrationName: string, + parameters: Migration, + options?: MigrationsCreateOptionalParams, + ) => create(context, resourceGroupName, serverName, migrationName, parameters, options), + get: ( + resourceGroupName: string, + serverName: string, + migrationName: string, + options?: MigrationsGetOptionalParams, + ) => get(context, resourceGroupName, serverName, migrationName, options), + }; +} + +export function _getMigrationsOperations( + context: PostgreSQLManagementFlexibleServerContext, +): MigrationsOperations { + return { + ..._getMigrations(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/nameAvailability/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/nameAvailability/index.ts new file mode 100644 index 000000000000..6d75bd801438 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/nameAvailability/index.ts @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { checkWithLocation, checkGlobally } from "../../api/nameAvailability/operations.js"; +import type { + NameAvailabilityCheckWithLocationOptionalParams, + NameAvailabilityCheckGloballyOptionalParams, +} from "../../api/nameAvailability/options.js"; +import type { CheckNameAvailabilityRequest, NameAvailabilityModel } from "../../models/models.js"; + +/** Interface representing a NameAvailability operations. */ +export interface NameAvailabilityOperations { + /** Check the availability of name for resource */ + checkWithLocation: ( + locationName: string, + parameters: CheckNameAvailabilityRequest, + options?: NameAvailabilityCheckWithLocationOptionalParams, + ) => Promise; + /** Checks the validity and availability of the given name, to assign it to a new server or to use it as the base name of a new pair of virtual endpoints. */ + checkGlobally: ( + parameters: CheckNameAvailabilityRequest, + options?: NameAvailabilityCheckGloballyOptionalParams, + ) => Promise; +} + +function _getNameAvailability(context: PostgreSQLManagementFlexibleServerContext) { + return { + checkWithLocation: ( + locationName: string, + parameters: CheckNameAvailabilityRequest, + options?: NameAvailabilityCheckWithLocationOptionalParams, + ) => checkWithLocation(context, locationName, parameters, options), + checkGlobally: ( + parameters: CheckNameAvailabilityRequest, + options?: NameAvailabilityCheckGloballyOptionalParams, + ) => checkGlobally(context, parameters, options), + }; +} + +export function _getNameAvailabilityOperations( + context: PostgreSQLManagementFlexibleServerContext, +): NameAvailabilityOperations { + return { + ..._getNameAvailability(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/operations/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/operations/index.ts new file mode 100644 index 000000000000..b618868e246a --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/operations/index.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { list } from "../../api/operations/operations.js"; +import type { OperationsListOptionalParams } from "../../api/operations/options.js"; +import type { Operation } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** Lists all available REST API operations. */ + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +function _getOperations(context: PostgreSQLManagementFlexibleServerContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations( + context: PostgreSQLManagementFlexibleServerContext, +): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/privateDnsZoneSuffix/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/privateDnsZoneSuffix/index.ts new file mode 100644 index 000000000000..55437ca3ea2f --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/privateDnsZoneSuffix/index.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { get } from "../../api/privateDnsZoneSuffix/operations.js"; +import type { PrivateDnsZoneSuffixGetOptionalParams } from "../../api/privateDnsZoneSuffix/options.js"; +import type { PrivateDnsZoneSuffixGetResponse } from "../../models/models.js"; + +/** Interface representing a PrivateDnsZoneSuffix operations. */ +export interface PrivateDnsZoneSuffixOperations { + /** Gets the private DNS zone suffix. */ + get: ( + options?: PrivateDnsZoneSuffixGetOptionalParams, + ) => Promise; +} + +function _getPrivateDnsZoneSuffix(context: PostgreSQLManagementFlexibleServerContext) { + return { + get: (options?: PrivateDnsZoneSuffixGetOptionalParams) => get(context, options), + }; +} + +export function _getPrivateDnsZoneSuffixOperations( + context: PostgreSQLManagementFlexibleServerContext, +): PrivateDnsZoneSuffixOperations { + return { + ..._getPrivateDnsZoneSuffix(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/privateEndpointConnections/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/privateEndpointConnections/index.ts new file mode 100644 index 000000000000..4808607b9451 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/privateEndpointConnections/index.ts @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { + listByServer, + $delete, + update, + get, +} from "../../api/privateEndpointConnections/operations.js"; +import type { + PrivateEndpointConnectionsListByServerOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsUpdateOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, +} from "../../api/privateEndpointConnections/options.js"; +import type { PrivateEndpointConnection } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a PrivateEndpointConnections operations. */ +export interface PrivateEndpointConnectionsOperations { + /** Lists all private endpoint connections on a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: PrivateEndpointConnectionsListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes a private endpoint connection. */ + /** + * @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, + serverName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => Promise; + /** Approves or rejects a private endpoint connection. */ + update: ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + parameters: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => PollerLike, PrivateEndpointConnection>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + parameters: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => Promise< + SimplePollerLike, PrivateEndpointConnection> + >; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + parameters: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => Promise; + /** Gets a private endpoint connection. */ + get: ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams, + ) => Promise; +} + +function _getPrivateEndpointConnections(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: PrivateEndpointConnectionsListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + delete: ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, serverName, privateEndpointConnectionName, options), + beginDelete: async ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => { + const poller = $delete( + context, + resourceGroupName, + serverName, + privateEndpointConnectionName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => { + return await $delete( + context, + resourceGroupName, + serverName, + privateEndpointConnectionName, + options, + ); + }, + update: ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + parameters: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => + update( + context, + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + options, + ), + beginUpdate: async ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + parameters: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => { + const poller = update( + context, + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + parameters: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsUpdateOptionalParams, + ) => { + return await update( + context, + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + options, + ); + }, + get: ( + resourceGroupName: string, + serverName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams, + ) => get(context, resourceGroupName, serverName, privateEndpointConnectionName, options), + }; +} + +export function _getPrivateEndpointConnectionsOperations( + context: PostgreSQLManagementFlexibleServerContext, +): PrivateEndpointConnectionsOperations { + return { + ..._getPrivateEndpointConnections(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/privateLinkResources/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/privateLinkResources/index.ts new file mode 100644 index 000000000000..5812f3b9b71c --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/privateLinkResources/index.ts @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { listByServer, get } from "../../api/privateLinkResources/operations.js"; +import type { + PrivateLinkResourcesListByServerOptionalParams, + PrivateLinkResourcesGetOptionalParams, +} from "../../api/privateLinkResources/options.js"; +import type { PrivateLinkResource } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a PrivateLinkResources operations. */ +export interface PrivateLinkResourcesOperations { + /** Gets the private link resources for PostgreSQL server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: PrivateLinkResourcesListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Gets a private link resource for PostgreSQL server. */ + get: ( + resourceGroupName: string, + serverName: string, + groupName: string, + options?: PrivateLinkResourcesGetOptionalParams, + ) => Promise; +} + +function _getPrivateLinkResources(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: PrivateLinkResourcesListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + get: ( + resourceGroupName: string, + serverName: string, + groupName: string, + options?: PrivateLinkResourcesGetOptionalParams, + ) => get(context, resourceGroupName, serverName, groupName, options), + }; +} + +export function _getPrivateLinkResourcesOperations( + context: PostgreSQLManagementFlexibleServerContext, +): PrivateLinkResourcesOperations { + return { + ..._getPrivateLinkResources(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/quotaUsages/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/quotaUsages/index.ts new file mode 100644 index 000000000000..946842776c8a --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/quotaUsages/index.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { list } from "../../api/quotaUsages/operations.js"; +import type { QuotaUsagesListOptionalParams } from "../../api/quotaUsages/options.js"; +import type { QuotaUsage } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a QuotaUsages operations. */ +export interface QuotaUsagesOperations { + /** Get quota usages at specified location in a given subscription. */ + list: ( + locationName: string, + options?: QuotaUsagesListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getQuotaUsages(context: PostgreSQLManagementFlexibleServerContext) { + return { + list: (locationName: string, options?: QuotaUsagesListOptionalParams) => + list(context, locationName, options), + }; +} + +export function _getQuotaUsagesOperations( + context: PostgreSQLManagementFlexibleServerContext, +): QuotaUsagesOperations { + return { + ..._getQuotaUsages(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/replicas/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/replicas/index.ts new file mode 100644 index 000000000000..5aabe6f68f0c --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/replicas/index.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { listByServer } from "../../api/replicas/operations.js"; +import type { ReplicasListByServerOptionalParams } from "../../api/replicas/options.js"; +import type { Server } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Replicas operations. */ +export interface ReplicasOperations { + /** Lists all read replicas of a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: ReplicasListByServerOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getReplicas(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: ReplicasListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + }; +} + +export function _getReplicasOperations( + context: PostgreSQLManagementFlexibleServerContext, +): ReplicasOperations { + return { + ..._getReplicas(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/serverThreatProtectionSettings/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/serverThreatProtectionSettings/index.ts new file mode 100644 index 000000000000..51116b2ee4c0 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/serverThreatProtectionSettings/index.ts @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { createOrUpdate } from "../../api/serverThreatProtectionSettings/operations.js"; +import type { ServerThreatProtectionSettingsCreateOrUpdateOptionalParams } from "../../api/serverThreatProtectionSettings/options.js"; +import type { + AdvancedThreatProtectionSettingsModel, + ThreatProtectionName, +} from "../../models/models.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a ServerThreatProtectionSettings operations. */ +export interface ServerThreatProtectionSettingsOperations { + /** Creates or updates a server's Advanced Threat Protection settings. */ + createOrUpdate: ( + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + parameters: AdvancedThreatProtectionSettingsModel, + options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, + ) => PollerLike< + OperationState, + AdvancedThreatProtectionSettingsModel + >; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + parameters: AdvancedThreatProtectionSettingsModel, + options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, + ) => Promise< + SimplePollerLike< + OperationState, + AdvancedThreatProtectionSettingsModel + > + >; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + parameters: AdvancedThreatProtectionSettingsModel, + options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, + ) => Promise; +} + +function _getServerThreatProtectionSettings(context: PostgreSQLManagementFlexibleServerContext) { + return { + createOrUpdate: ( + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + parameters: AdvancedThreatProtectionSettingsModel, + options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + serverName, + threatProtectionName, + parameters, + options, + ), + beginCreateOrUpdate: async ( + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + parameters: AdvancedThreatProtectionSettingsModel, + options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + serverName, + threatProtectionName, + parameters, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + serverName: string, + threatProtectionName: ThreatProtectionName, + parameters: AdvancedThreatProtectionSettingsModel, + options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + serverName, + threatProtectionName, + parameters, + options, + ); + }, + }; +} + +export function _getServerThreatProtectionSettingsOperations( + context: PostgreSQLManagementFlexibleServerContext, +): ServerThreatProtectionSettingsOperations { + return { + ..._getServerThreatProtectionSettings(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/servers/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/servers/index.ts new file mode 100644 index 000000000000..a53db1124d6e --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/servers/index.ts @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { + migrateNetworkMode, + stop, + start, + restart, + listBySubscription, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/servers/operations.js"; +import type { + ServersMigrateNetworkModeOptionalParams, + ServersStopOptionalParams, + ServersStartOptionalParams, + ServersRestartOptionalParams, + ServersListBySubscriptionOptionalParams, + ServersListByResourceGroupOptionalParams, + ServersDeleteOptionalParams, + ServersUpdateOptionalParams, + ServersCreateOrUpdateOptionalParams, + ServersGetOptionalParams, +} from "../../api/servers/options.js"; +import type { Server, ServerForPatch, MigrateNetworkStatus } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Servers operations. */ +export interface ServersOperations { + /** Migrates the network configuration of a PostgreSQL flexible server from customer owned VNET to Microsoft owned VNET with support for private endpoints, or from Microsoft owned VNET with no support for private endpoints to Microsoft owned VNET with support for private endpoints. */ + migrateNetworkMode: ( + resourceGroupName: string, + serverName: string, + options?: ServersMigrateNetworkModeOptionalParams, + ) => PollerLike, MigrateNetworkStatus>; + /** @deprecated use migrateNetworkMode instead */ + beginMigrateNetworkMode: ( + resourceGroupName: string, + serverName: string, + options?: ServersMigrateNetworkModeOptionalParams, + ) => Promise, MigrateNetworkStatus>>; + /** @deprecated use migrateNetworkMode instead */ + beginMigrateNetworkModeAndWait: ( + resourceGroupName: string, + serverName: string, + options?: ServersMigrateNetworkModeOptionalParams, + ) => Promise; + /** Stops a server. */ + stop: ( + resourceGroupName: string, + serverName: string, + options?: ServersStopOptionalParams, + ) => PollerLike, void>; + /** @deprecated use stop instead */ + beginStop: ( + resourceGroupName: string, + serverName: string, + options?: ServersStopOptionalParams, + ) => Promise, void>>; + /** @deprecated use stop instead */ + beginStopAndWait: ( + resourceGroupName: string, + serverName: string, + options?: ServersStopOptionalParams, + ) => Promise; + /** Starts a stopped server. */ + start: ( + resourceGroupName: string, + serverName: string, + options?: ServersStartOptionalParams, + ) => PollerLike, void>; + /** @deprecated use start instead */ + beginStart: ( + resourceGroupName: string, + serverName: string, + options?: ServersStartOptionalParams, + ) => Promise, void>>; + /** @deprecated use start instead */ + beginStartAndWait: ( + resourceGroupName: string, + serverName: string, + options?: ServersStartOptionalParams, + ) => Promise; + /** Restarts PostgreSQL database engine in a server. */ + restart: ( + resourceGroupName: string, + serverName: string, + options?: ServersRestartOptionalParams, + ) => PollerLike, void>; + /** @deprecated use restart instead */ + beginRestart: ( + resourceGroupName: string, + serverName: string, + options?: ServersRestartOptionalParams, + ) => Promise, void>>; + /** @deprecated use restart instead */ + beginRestartAndWait: ( + resourceGroupName: string, + serverName: string, + options?: ServersRestartOptionalParams, + ) => Promise; + /** Lists all servers in a subscription. */ + listBySubscription: ( + options?: ServersListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists all servers in a resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: ServersListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes or drops an existing server. */ + /** + * @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, + serverName: string, + options?: ServersDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + serverName: string, + options?: ServersDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + serverName: string, + options?: ServersDeleteOptionalParams, + ) => Promise; + /** Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition. */ + update: ( + resourceGroupName: string, + serverName: string, + parameters: ServerForPatch, + options?: ServersUpdateOptionalParams, + ) => PollerLike, Server>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + serverName: string, + parameters: ServerForPatch, + options?: ServersUpdateOptionalParams, + ) => Promise, Server>>; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + serverName: string, + parameters: ServerForPatch, + options?: ServersUpdateOptionalParams, + ) => Promise; + /** Creates a new server. */ + createOrUpdate: ( + resourceGroupName: string, + serverName: string, + parameters: Server, + options?: ServersCreateOrUpdateOptionalParams, + ) => PollerLike, Server>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + serverName: string, + parameters: Server, + options?: ServersCreateOrUpdateOptionalParams, + ) => Promise, Server>>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + serverName: string, + parameters: Server, + options?: ServersCreateOrUpdateOptionalParams, + ) => Promise; + /** Gets information about an existing server. */ + get: ( + resourceGroupName: string, + serverName: string, + options?: ServersGetOptionalParams, + ) => Promise; +} + +function _getServers(context: PostgreSQLManagementFlexibleServerContext) { + return { + migrateNetworkMode: ( + resourceGroupName: string, + serverName: string, + options?: ServersMigrateNetworkModeOptionalParams, + ) => migrateNetworkMode(context, resourceGroupName, serverName, options), + beginMigrateNetworkMode: async ( + resourceGroupName: string, + serverName: string, + options?: ServersMigrateNetworkModeOptionalParams, + ) => { + const poller = migrateNetworkMode(context, resourceGroupName, serverName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginMigrateNetworkModeAndWait: async ( + resourceGroupName: string, + serverName: string, + options?: ServersMigrateNetworkModeOptionalParams, + ) => { + return await migrateNetworkMode(context, resourceGroupName, serverName, options); + }, + stop: (resourceGroupName: string, serverName: string, options?: ServersStopOptionalParams) => + stop(context, resourceGroupName, serverName, options), + beginStop: async ( + resourceGroupName: string, + serverName: string, + options?: ServersStopOptionalParams, + ) => { + const poller = stop(context, resourceGroupName, serverName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginStopAndWait: async ( + resourceGroupName: string, + serverName: string, + options?: ServersStopOptionalParams, + ) => { + return await stop(context, resourceGroupName, serverName, options); + }, + start: (resourceGroupName: string, serverName: string, options?: ServersStartOptionalParams) => + start(context, resourceGroupName, serverName, options), + beginStart: async ( + resourceGroupName: string, + serverName: string, + options?: ServersStartOptionalParams, + ) => { + const poller = start(context, resourceGroupName, serverName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginStartAndWait: async ( + resourceGroupName: string, + serverName: string, + options?: ServersStartOptionalParams, + ) => { + return await start(context, resourceGroupName, serverName, options); + }, + restart: ( + resourceGroupName: string, + serverName: string, + options?: ServersRestartOptionalParams, + ) => restart(context, resourceGroupName, serverName, options), + beginRestart: async ( + resourceGroupName: string, + serverName: string, + options?: ServersRestartOptionalParams, + ) => { + const poller = restart(context, resourceGroupName, serverName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginRestartAndWait: async ( + resourceGroupName: string, + serverName: string, + options?: ServersRestartOptionalParams, + ) => { + return await restart(context, resourceGroupName, serverName, options); + }, + listBySubscription: (options?: ServersListBySubscriptionOptionalParams) => + listBySubscription(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: ServersListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + serverName: string, + options?: ServersDeleteOptionalParams, + ) => $delete(context, resourceGroupName, serverName, options), + beginDelete: async ( + resourceGroupName: string, + serverName: string, + options?: ServersDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, serverName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + serverName: string, + options?: ServersDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, serverName, options); + }, + update: ( + resourceGroupName: string, + serverName: string, + parameters: ServerForPatch, + options?: ServersUpdateOptionalParams, + ) => update(context, resourceGroupName, serverName, parameters, options), + beginUpdate: async ( + resourceGroupName: string, + serverName: string, + parameters: ServerForPatch, + options?: ServersUpdateOptionalParams, + ) => { + const poller = update(context, resourceGroupName, serverName, parameters, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + serverName: string, + parameters: ServerForPatch, + options?: ServersUpdateOptionalParams, + ) => { + return await update(context, resourceGroupName, serverName, parameters, options); + }, + createOrUpdate: ( + resourceGroupName: string, + serverName: string, + parameters: Server, + options?: ServersCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, serverName, parameters, options), + beginCreateOrUpdate: async ( + resourceGroupName: string, + serverName: string, + parameters: Server, + options?: ServersCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate(context, resourceGroupName, serverName, parameters, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + serverName: string, + parameters: Server, + options?: ServersCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate(context, resourceGroupName, serverName, parameters, options); + }, + get: (resourceGroupName: string, serverName: string, options?: ServersGetOptionalParams) => + get(context, resourceGroupName, serverName, options), + }; +} + +export function _getServersOperations( + context: PostgreSQLManagementFlexibleServerContext, +): ServersOperations { + return { + ..._getServers(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/tuningOptions/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/tuningOptions/index.ts new file mode 100644 index 000000000000..12cb4301fa85 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/tuningOptions/index.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { listRecommendations, listByServer, get } from "../../api/tuningOptions/operations.js"; +import type { + TuningOptionsListRecommendationsOptionalParams, + TuningOptionsListByServerOptionalParams, + TuningOptionsGetOptionalParams, +} from "../../api/tuningOptions/options.js"; +import type { + TuningOptions, + TuningOptionParameterEnum, + ObjectRecommendation, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a TuningOptions operations. */ +export interface TuningOptionsOperations { + /** Lists available object recommendations. */ + listRecommendations: ( + resourceGroupName: string, + serverName: string, + tuningOption: TuningOptionParameterEnum, + options?: TuningOptionsListRecommendationsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists the tuning options of a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: TuningOptionsListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Gets the tuning options of a server. */ + get: ( + resourceGroupName: string, + serverName: string, + tuningOption: TuningOptionParameterEnum, + options?: TuningOptionsGetOptionalParams, + ) => Promise; +} + +function _getTuningOptions(context: PostgreSQLManagementFlexibleServerContext) { + return { + listRecommendations: ( + resourceGroupName: string, + serverName: string, + tuningOption: TuningOptionParameterEnum, + options?: TuningOptionsListRecommendationsOptionalParams, + ) => listRecommendations(context, resourceGroupName, serverName, tuningOption, options), + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: TuningOptionsListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + get: ( + resourceGroupName: string, + serverName: string, + tuningOption: TuningOptionParameterEnum, + options?: TuningOptionsGetOptionalParams, + ) => get(context, resourceGroupName, serverName, tuningOption, options), + }; +} + +export function _getTuningOptionsOperations( + context: PostgreSQLManagementFlexibleServerContext, +): TuningOptionsOperations { + return { + ..._getTuningOptions(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/virtualEndpoints/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/virtualEndpoints/index.ts new file mode 100644 index 000000000000..1666f540ca20 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/virtualEndpoints/index.ts @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { + listByServer, + $delete, + update, + create, + get, +} from "../../api/virtualEndpoints/operations.js"; +import type { + VirtualEndpointsListByServerOptionalParams, + VirtualEndpointsDeleteOptionalParams, + VirtualEndpointsUpdateOptionalParams, + VirtualEndpointsCreateOptionalParams, + VirtualEndpointsGetOptionalParams, +} from "../../api/virtualEndpoints/options.js"; +import type { VirtualEndpoint, VirtualEndpointResourceForPatch } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { SimplePollerLike } from "../../static-helpers/simplePollerHelpers.js"; +import { getSimplePoller } from "../../static-helpers/simplePollerHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a VirtualEndpoints operations. */ +export interface VirtualEndpointsOperations { + /** Lists pair of virtual endpoints associated to a server. */ + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: VirtualEndpointsListByServerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes a pair of virtual endpoints. */ + /** + * @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, + serverName: string, + virtualEndpointName: string, + options?: VirtualEndpointsDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options?: VirtualEndpointsDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options?: VirtualEndpointsDeleteOptionalParams, + ) => Promise; + /** Updates a pair of virtual endpoints for a server. */ + update: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpointResourceForPatch, + options?: VirtualEndpointsUpdateOptionalParams, + ) => PollerLike, VirtualEndpoint>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpointResourceForPatch, + options?: VirtualEndpointsUpdateOptionalParams, + ) => Promise, VirtualEndpoint>>; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpointResourceForPatch, + options?: VirtualEndpointsUpdateOptionalParams, + ) => Promise; + /** Creates a pair of virtual endpoints for a server. */ + create: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpoint, + options?: VirtualEndpointsCreateOptionalParams, + ) => PollerLike, VirtualEndpoint>; + /** @deprecated use create instead */ + beginCreate: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpoint, + options?: VirtualEndpointsCreateOptionalParams, + ) => Promise, VirtualEndpoint>>; + /** @deprecated use create instead */ + beginCreateAndWait: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpoint, + options?: VirtualEndpointsCreateOptionalParams, + ) => Promise; + /** Gets information about a pair of virtual endpoints. */ + get: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options?: VirtualEndpointsGetOptionalParams, + ) => Promise; +} + +function _getVirtualEndpoints(context: PostgreSQLManagementFlexibleServerContext) { + return { + listByServer: ( + resourceGroupName: string, + serverName: string, + options?: VirtualEndpointsListByServerOptionalParams, + ) => listByServer(context, resourceGroupName, serverName, options), + delete: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options?: VirtualEndpointsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, serverName, virtualEndpointName, options), + beginDelete: async ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options?: VirtualEndpointsDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, serverName, virtualEndpointName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options?: VirtualEndpointsDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, serverName, virtualEndpointName, options); + }, + update: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpointResourceForPatch, + options?: VirtualEndpointsUpdateOptionalParams, + ) => update(context, resourceGroupName, serverName, virtualEndpointName, parameters, options), + beginUpdate: async ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpointResourceForPatch, + options?: VirtualEndpointsUpdateOptionalParams, + ) => { + const poller = update( + context, + resourceGroupName, + serverName, + virtualEndpointName, + parameters, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpointResourceForPatch, + options?: VirtualEndpointsUpdateOptionalParams, + ) => { + return await update( + context, + resourceGroupName, + serverName, + virtualEndpointName, + parameters, + options, + ); + }, + create: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpoint, + options?: VirtualEndpointsCreateOptionalParams, + ) => create(context, resourceGroupName, serverName, virtualEndpointName, parameters, options), + beginCreate: async ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpoint, + options?: VirtualEndpointsCreateOptionalParams, + ) => { + const poller = create( + context, + resourceGroupName, + serverName, + virtualEndpointName, + parameters, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateAndWait: async ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + parameters: VirtualEndpoint, + options?: VirtualEndpointsCreateOptionalParams, + ) => { + return await create( + context, + resourceGroupName, + serverName, + virtualEndpointName, + parameters, + options, + ); + }, + get: ( + resourceGroupName: string, + serverName: string, + virtualEndpointName: string, + options?: VirtualEndpointsGetOptionalParams, + ) => get(context, resourceGroupName, serverName, virtualEndpointName, options), + }; +} + +export function _getVirtualEndpointsOperations( + context: PostgreSQLManagementFlexibleServerContext, +): VirtualEndpointsOperations { + return { + ..._getVirtualEndpoints(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/classic/virtualNetworkSubnetUsage/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/classic/virtualNetworkSubnetUsage/index.ts new file mode 100644 index 000000000000..bbbecebfeed4 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/classic/virtualNetworkSubnetUsage/index.ts @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerContext } from "../../api/postgreSQLManagementFlexibleServerContext.js"; +import { list } from "../../api/virtualNetworkSubnetUsage/operations.js"; +import type { VirtualNetworkSubnetUsageListOptionalParams } from "../../api/virtualNetworkSubnetUsage/options.js"; +import type { + VirtualNetworkSubnetUsageParameter, + VirtualNetworkSubnetUsageModel, +} from "../../models/models.js"; + +/** Interface representing a VirtualNetworkSubnetUsage operations. */ +export interface VirtualNetworkSubnetUsageOperations { + /** Lists the virtual network subnet usage for a given virtual network. */ + list: ( + locationName: string, + parameters: VirtualNetworkSubnetUsageParameter, + options?: VirtualNetworkSubnetUsageListOptionalParams, + ) => Promise; +} + +function _getVirtualNetworkSubnetUsage(context: PostgreSQLManagementFlexibleServerContext) { + return { + list: ( + locationName: string, + parameters: VirtualNetworkSubnetUsageParameter, + options?: VirtualNetworkSubnetUsageListOptionalParams, + ) => list(context, locationName, parameters, options), + }; +} + +export function _getVirtualNetworkSubnetUsageOperations( + context: PostgreSQLManagementFlexibleServerContext, +): VirtualNetworkSubnetUsageOperations { + return { + ..._getVirtualNetworkSubnetUsage(context), + }; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/index.ts index 9f38d4592591..0efdf6013ff1 100644 --- a/sdk/postgresql/arm-postgresql-flexible/src/index.ts +++ b/sdk/postgresql/arm-postgresql-flexible/src/index.ts @@ -1,11 +1,387 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +import type { AzureSupportedClouds } from "./static-helpers/cloudSettingHelpers.js"; +import { AzureClouds } from "./static-helpers/cloudSettingHelpers.js"; +import type { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; -/// -export { getContinuationToken } from "./pagingHelper.js"; -export * from "./models/index.js"; export { PostgreSQLManagementFlexibleServerClient } from "./postgreSQLManagementFlexibleServerClient.js"; -export * from "./operationsInterfaces/index.js"; +export type { SimplePollerLike } from "./static-helpers/simplePollerHelpers.js"; +export type { RestorePollerOptions } from "./restorePollerHelpers.js"; +export { restorePoller } from "./restorePollerHelpers.js"; +export type { + Operation, + OperationDisplay, + OperationOrigin, + OperationProperties, + ServiceSpecification, + MetricSpecification, + LogSpecification, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + Migration, + MigrationProperties, + MigrationStatus, + MigrationState, + MigrationSubstateDetails, + MigrationSubstate, + DatabaseMigrationState, + MigrationDatabaseState, + ValidationDetails, + ValidationState, + ValidationSummaryItem, + ValidationMessage, + DbLevelValidationStatus, + MigrationMode, + MigrationOption, + SourceType, + SslMode, + DbServerMetadata, + ServerSku, + SkuTier, + MigrationSecretParameters, + AdminCredentials, + LogicalReplicationOnSourceServer, + OverwriteDatabasesOnTargetServer, + MigrateRolesAndPermissions, + StartDataMigration, + TriggerCutover, + Cancel, + TrackedResource, + Resource, + SystemData, + CreatedByType, + MigrationResourceForPatch, + MigrationPropertiesForPatch, + MigrationSecretParametersForPatch, + AdminCredentialsForPatch, + MigrationNameAvailability, + MigrationNameAvailabilityReason, + Server, + ServerProperties, + PostgresMajorVersion, + ServerState, + Storage, + StorageAutoGrow, + AzureManagedDiskPerformanceTier, + StorageType, + AuthConfig, + MicrosoftEntraAuth, + PasswordBasedAuth, + DataEncryption, + DataEncryptionType, + EncryptionKeyStatus, + Backup, + GeographicallyRedundantBackup, + Network, + ServerPublicNetworkAccessState, + HighAvailability, + PostgreSqlFlexibleServerHighAvailabilityMode, + HighAvailabilityState, + MaintenanceWindow, + ReplicationRole, + Replica, + ReplicationState, + ReadReplicaPromoteMode, + ReadReplicaPromoteOption, + CreateMode, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + PrivateEndpointServiceConnectionStatus, + PrivateEndpointConnectionProvisioningState, + Cluster, + Sku, + UserAssignedIdentity, + UserIdentity, + IdentityType, + ServerForPatch, + SkuForPatch, + ServerPropertiesForPatch, + BackupForPatch, + HighAvailabilityForPatch, + MaintenanceWindowForPatch, + AuthConfigForPatch, + CreateModeForPatch, + RestartParameter, + FailoverMode, + MigrateNetworkStatus, + NetworkMigrationState, + Configuration, + ConfigurationProperties, + ConfigurationDataType, + ProxyResource, + ConfigurationForUpdate, + Database, + DatabaseProperties, + FirewallRule, + FirewallRuleProperties, + PrivateLinkResource, + PrivateLinkResourceProperties, + VirtualEndpoint, + VirtualEndpointResourceProperties, + VirtualEndpointType, + VirtualEndpointResourceForPatch, + AdministratorMicrosoftEntra, + AdministratorMicrosoftEntraProperties, + PrincipalType, + AdministratorMicrosoftEntraAdd, + AdministratorMicrosoftEntraPropertiesForAdd, + Capability, + ServerEditionCapability, + StorageEditionCapability, + StorageMbCapability, + StorageTierCapability, + ServerSkuCapability, + HighAvailabilityMode, + SupportedFeature, + FeatureStatus, + ServerVersionCapability, + FastProvisioningSupport, + FastProvisioningEditionCapability, + GeographicallyRedundantBackupSupport, + ZoneRedundantHighAvailabilitySupport, + ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport, + StorageAutoGrowthSupport, + OnlineStorageResizeSupport, + LocationRestricted, + CapabilityBase, + CapabilityStatus, + CapturedLog, + CapturedLogProperties, + LtrPreBackupRequest, + BackupRequestBase, + BackupSettings, + LtrPreBackupResponse, + BackupsLongTermRetentionResponseProperties, + BackupsLongTermRetentionRequest, + BackupStoreDetails, + BackupsLongTermRetentionResponse, + LtrBackupOperationResponseProperties, + ExecutionStatus, + BackupsLongTermRetentionOperation, + AdvancedThreatProtectionSettingsModel, + AdvancedThreatProtectionSettingsProperties, + ThreatProtectionState, + ThreatProtectionName, + BackupAutomaticAndOnDemand, + BackupAutomaticAndOnDemandProperties, + BackupType, + TuningOptions, + TuningOptionsProperties, + TuningOptionParameterEnum, + ObjectRecommendation, + ObjectRecommendationProperties, + RecommendationTypeEnum, + ObjectRecommendationPropertiesImplementationDetails, + ObjectRecommendationPropertiesAnalyzedWorkload, + ImpactRecord, + ObjectRecommendationDetails, + CheckNameAvailabilityRequest, + NameAvailabilityModel, + CheckNameAvailabilityResponse, + CheckNameAvailabilityReason, + QuotaUsage, + NameProperty, + VirtualNetworkSubnetUsageParameter, + VirtualNetworkSubnetUsageModel, + DelegatedSubnetUsage, + MigrationListFilter, + RecommendationTypeParameterEnum, + PrivateDnsZoneSuffixGetResponse, +} from "./models/index.js"; +export { + KnownOperationOrigin, + KnownMigrationState, + KnownMigrationSubstate, + KnownMigrationDatabaseState, + KnownValidationState, + KnownMigrationMode, + KnownMigrationOption, + KnownSourceType, + KnownSslMode, + KnownSkuTier, + KnownLogicalReplicationOnSourceServer, + KnownOverwriteDatabasesOnTargetServer, + KnownMigrateRolesAndPermissions, + KnownStartDataMigration, + KnownTriggerCutover, + KnownCancel, + KnownCreatedByType, + KnownMigrationNameAvailabilityReason, + KnownPostgresMajorVersion, + KnownServerState, + KnownStorageAutoGrow, + KnownAzureManagedDiskPerformanceTier, + KnownStorageType, + KnownMicrosoftEntraAuth, + KnownPasswordBasedAuth, + KnownDataEncryptionType, + KnownEncryptionKeyStatus, + KnownGeographicallyRedundantBackup, + KnownServerPublicNetworkAccessState, + KnownPostgreSqlFlexibleServerHighAvailabilityMode, + KnownHighAvailabilityState, + KnownReplicationRole, + KnownReplicationState, + KnownReadReplicaPromoteMode, + KnownReadReplicaPromoteOption, + KnownCreateMode, + KnownPrivateEndpointServiceConnectionStatus, + KnownPrivateEndpointConnectionProvisioningState, + KnownIdentityType, + KnownCreateModeForPatch, + KnownFailoverMode, + KnownNetworkMigrationState, + KnownConfigurationDataType, + KnownVirtualEndpointType, + KnownPrincipalType, + KnownHighAvailabilityMode, + KnownFeatureStatus, + KnownFastProvisioningSupport, + KnownGeographicallyRedundantBackupSupport, + KnownZoneRedundantHighAvailabilitySupport, + KnownZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport, + KnownStorageAutoGrowthSupport, + KnownOnlineStorageResizeSupport, + KnownLocationRestricted, + KnownExecutionStatus, + KnownThreatProtectionName, + KnownBackupType, + KnownTuningOptionParameterEnum, + KnownRecommendationTypeEnum, + KnownCheckNameAvailabilityReason, + KnownMigrationListFilter, + KnownRecommendationTypeParameterEnum, + KnownVersions, +} from "./models/index.js"; +export type { PostgreSQLManagementFlexibleServerClientOptionalParams } from "./api/index.js"; +export type { + AdministratorsMicrosoftEntraListByServerOptionalParams, + AdministratorsMicrosoftEntraDeleteOptionalParams, + AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, + AdministratorsMicrosoftEntraGetOptionalParams, +} from "./api/administratorsMicrosoftEntra/index.js"; +export type { + AdvancedThreatProtectionSettingsListByServerOptionalParams, + AdvancedThreatProtectionSettingsGetOptionalParams, +} from "./api/advancedThreatProtectionSettings/index.js"; +export type { + BackupsAutomaticAndOnDemandListByServerOptionalParams, + BackupsAutomaticAndOnDemandDeleteOptionalParams, + BackupsAutomaticAndOnDemandCreateOptionalParams, + BackupsAutomaticAndOnDemandGetOptionalParams, +} from "./api/backupsAutomaticAndOnDemand/index.js"; +export type { + BackupsLongTermRetentionListByServerOptionalParams, + BackupsLongTermRetentionGetOptionalParams, + BackupsLongTermRetentionStartOptionalParams, + BackupsLongTermRetentionCheckPrerequisitesOptionalParams, +} from "./api/backupsLongTermRetention/index.js"; +export type { CapabilitiesByLocationListOptionalParams } from "./api/capabilitiesByLocation/index.js"; +export type { CapabilitiesByServerListOptionalParams } from "./api/capabilitiesByServer/index.js"; +export type { CapturedLogsListByServerOptionalParams } from "./api/capturedLogs/index.js"; +export type { + ConfigurationsListByServerOptionalParams, + ConfigurationsUpdateOptionalParams, + ConfigurationsPutOptionalParams, + ConfigurationsGetOptionalParams, +} from "./api/configurations/index.js"; +export type { + DatabasesListByServerOptionalParams, + DatabasesDeleteOptionalParams, + DatabasesCreateOptionalParams, + DatabasesGetOptionalParams, +} from "./api/databases/index.js"; +export type { + FirewallRulesListByServerOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesGetOptionalParams, +} from "./api/firewallRules/index.js"; +export type { + MigrationsCheckNameAvailabilityOptionalParams, + MigrationsListByTargetServerOptionalParams, + MigrationsCancelOptionalParams, + MigrationsUpdateOptionalParams, + MigrationsCreateOptionalParams, + MigrationsGetOptionalParams, +} from "./api/migrations/index.js"; +export type { + NameAvailabilityCheckWithLocationOptionalParams, + NameAvailabilityCheckGloballyOptionalParams, +} from "./api/nameAvailability/index.js"; +export type { OperationsListOptionalParams } from "./api/operations/index.js"; +export type { PrivateDnsZoneSuffixGetOptionalParams } from "./api/privateDnsZoneSuffix/index.js"; +export type { + PrivateEndpointConnectionsListByServerOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsUpdateOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, +} from "./api/privateEndpointConnections/index.js"; +export type { + PrivateLinkResourcesListByServerOptionalParams, + PrivateLinkResourcesGetOptionalParams, +} from "./api/privateLinkResources/index.js"; +export type { QuotaUsagesListOptionalParams } from "./api/quotaUsages/index.js"; +export type { ReplicasListByServerOptionalParams } from "./api/replicas/index.js"; +export type { + ServersMigrateNetworkModeOptionalParams, + ServersStopOptionalParams, + ServersStartOptionalParams, + ServersRestartOptionalParams, + ServersListBySubscriptionOptionalParams, + ServersListByResourceGroupOptionalParams, + ServersDeleteOptionalParams, + ServersUpdateOptionalParams, + ServersCreateOrUpdateOptionalParams, + ServersGetOptionalParams, +} from "./api/servers/index.js"; +export type { ServerThreatProtectionSettingsCreateOrUpdateOptionalParams } from "./api/serverThreatProtectionSettings/index.js"; +export type { + TuningOptionsListRecommendationsOptionalParams, + TuningOptionsListByServerOptionalParams, + TuningOptionsGetOptionalParams, +} from "./api/tuningOptions/index.js"; +export type { + VirtualEndpointsListByServerOptionalParams, + VirtualEndpointsDeleteOptionalParams, + VirtualEndpointsUpdateOptionalParams, + VirtualEndpointsCreateOptionalParams, + VirtualEndpointsGetOptionalParams, +} from "./api/virtualEndpoints/index.js"; +export type { VirtualNetworkSubnetUsageListOptionalParams } from "./api/virtualNetworkSubnetUsage/index.js"; +export type { + AdministratorsMicrosoftEntraOperations, + AdvancedThreatProtectionSettingsOperations, + BackupsAutomaticAndOnDemandOperations, + BackupsLongTermRetentionOperations, + CapabilitiesByLocationOperations, + CapabilitiesByServerOperations, + CapturedLogsOperations, + ConfigurationsOperations, + DatabasesOperations, + FirewallRulesOperations, + MigrationsOperations, + NameAvailabilityOperations, + OperationsOperations, + PrivateDnsZoneSuffixOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QuotaUsagesOperations, + ReplicasOperations, + ServersOperations, + ServerThreatProtectionSettingsOperations, + TuningOptionsOperations, + VirtualEndpointsOperations, + VirtualNetworkSubnetUsageOperations, +} from "./classic/index.js"; +export type { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; +export { AzureClouds }; +export type { AzureSupportedClouds }; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/logger.ts b/sdk/postgresql/arm-postgresql-flexible/src/logger.ts new file mode 100644 index 000000000000..d424e2d2df41 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/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-postgresql-flexible"); diff --git a/sdk/postgresql/arm-postgresql-flexible/src/lroImpl.ts b/sdk/postgresql/arm-postgresql-flexible/src/lroImpl.ts deleted file mode 100644 index 064aab0f7c7f..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/lroImpl.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { AbortSignalLike } from "@azure/abort-controller"; -import type { LongRunningOperation, LroResponse } from "@azure/core-lro"; - -export function createLroSpec(inputs: { - sendOperationFn: (args: any, spec: any) => Promise>; - args: Record; - spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record; -}): LongRunningOperation { - const { args, spec, sendOperationFn } = inputs; - return { - requestMethod: spec.httpMethod, - requestPath: spec.path!, - sendInitialRequest: () => sendOperationFn(args, spec), - sendPollRequest: (path: string, options?: { abortSignal?: AbortSignalLike }) => { - const { requestBody, ...restSpec } = spec; - return sendOperationFn(args, { - ...restSpec, - httpMethod: "GET", - path, - abortSignal: options?.abortSignal, - }); - }, - }; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/models/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/models/index.ts index 8c22e1e854c5..80d4d46196d4 100644 --- a/sdk/postgresql/arm-postgresql-flexible/src/models/index.ts +++ b/sdk/postgresql/arm-postgresql-flexible/src/models/index.ts @@ -1,4019 +1,251 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type * as coreClient from "@azure/core-client"; - -/** Server administrator associated to a Microsoft Entra principal. */ -export interface AdministratorMicrosoftEntraAdd { - /** Type of Microsoft Entra principal to which the server administrator is associated. */ - principalType?: PrincipalType; - /** Name of the Microsoft Entra principal. */ - principalName?: string; - /** Identifier of the tenant in which the Microsoft Entra principal exists. */ - tenantId?: string; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** - * Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: 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; -} - -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ -export interface ErrorResponse { - /** The error object. */ - error?: ErrorDetail; -} - -/** The error detail. */ -export interface ErrorDetail { - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; - /** - * The error target. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly target?: string; - /** - * The error details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: ErrorDetail[]; - /** - * The error additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfo { - /** - * The additional info type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * The additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly info?: Record; -} - -/** List of server administrators associated to Microsoft Entra principals. */ -export interface AdministratorMicrosoftEntraList { - /** List of server administrators associated to Microsoft Entra principals. */ - value?: AdministratorMicrosoftEntra[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** List of advanced threat protection settings for a server. */ -export interface AdvancedThreatProtectionSettingsList { - /** - * Array of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: AdvancedThreatProtectionSettingsModel[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** List of backups. */ -export interface BackupAutomaticAndOnDemandList { - /** List of available backups. */ - value?: BackupAutomaticAndOnDemand[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** List of capabilities for the Azure Database for PostgreSQL flexible server. */ -export interface CapabilityList { - /** - * List of supported capabilities. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Capability[]; - /** Link to retrieve next page of results. */ - nextLink?: string; -} - -/** Base object for representing capability */ -export interface CapabilityBase { - /** - * The status of the capability. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: CapabilityStatus; - /** - * The reason for the capability not being available. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly reason?: string; -} - -/** Features supported. */ -export interface SupportedFeature { - /** - * Name of the feature. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Status of the feature. Indicates if the feature is enabled or not. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: FeatureStatus; -} - -/** List of log files. */ -export interface CapturedLogList { - /** List of log files in a server. */ - value?: CapturedLog[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** List of configurations (also known as server parameters). */ -export interface ConfigurationList { - /** List of configurations (also known as server parameters). */ - value?: Configuration[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** Configuration (also known as server parameter). */ -export interface ConfigurationForUpdate { - /** Value of the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ - value?: string; - /** - * Description of the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; - /** - * Value assigned by default to the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly defaultValue?: string; - /** - * Data type of the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly dataType?: ConfigurationDataType; - /** - * Allowed values of the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly allowedValues?: string; - /** Source of the value assigned to the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ - source?: string; - /** - * Indicates if it's a dynamic (true) or static (false) configuration (also known as server parameter). Static server parameters require a server restart after changing the value assigned to them, for the change to take effect. Dynamic server parameters do not require a server restart after changing the value assigned to them, for the change to take effect. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isDynamicConfig?: boolean; - /** - * Indicates if it's a read-only (true) or modifiable (false) configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isReadOnly?: boolean; - /** - * Indicates if the value assigned to the configuration (also known as server parameter) is pending a server restart for it to take effect. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isConfigPendingRestart?: boolean; - /** - * Units in which the configuration (also known as server parameter) value is expressed. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly unit?: string; - /** - * Link pointing to the documentation of the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly documentationLink?: string; -} - -/** List of all databases in a server. */ -export interface DatabaseList { - /** List of all databases in a server. */ - value?: Database[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** List of firewall rules. */ -export interface FirewallRuleList { - /** List of firewall rules in a server. */ - value?: FirewallRule[]; - /** Link to retrieve next page of results. */ - nextLink?: string; -} - -/** BackupRequestBase is the base for all backup request. */ -export interface BackupRequestBase { - /** Backup Settings */ - backupSettings: BackupSettings; -} - -/** The settings for the long term backup. */ -export interface BackupSettings { - /** Backup Name for the current backup */ - backupName: string; -} - -/** Response for the LTR pre-backup API call */ -export interface LtrPreBackupResponse { - /** Number of storage containers the plugin will use during backup. More than one containers may be used for size limitations, parallelism, or redundancy etc. */ - numberOfContainers: number; -} - -/** Details about the target where the backup content will be stored. */ -export interface BackupStoreDetails { - /** List of SAS uri of storage containers where backup data is to be streamed/copied. */ - sasUriList: string[]; -} - -/** Response for the LTR backup API call */ -export interface BackupsLongTermRetentionResponse { - /** Size of datasource in bytes */ - datasourceSizeInBytes?: number; - /** Data transferred in bytes */ - dataTransferredInBytes?: number; - /** Name of Backup operation */ - backupName?: string; - /** Metadata to be stored in RP. Store everything that will be required to perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc */ - backupMetadata?: string; - /** Service-set extensible enum indicating the status of operation */ - status?: ExecutionStatus; - /** Start time of the operation. */ - startTime?: Date; - /** End time of the operation. */ - endTime?: Date; - /** PercentageCompleted */ - percentComplete?: number; - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly errorCode?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly errorMessage?: string; -} - -/** A list of long term retention backup operations for server. */ -export interface LtrServerBackupOperationList { - /** The list of long term retention server backup operations */ - value?: BackupsLongTermRetentionOperation[]; - /** The link used to get the next page of operations. */ - nextLink?: string; -} - -/** State of migration. */ -export interface MigrationStatus { - /** - * State of migration. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly state?: MigrationState; - /** - * Error message, if any, for the migration state. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly error?: string; - /** - * Current migration sub state details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly currentSubStateDetails?: MigrationSubstateDetails; -} - -/** Details of migration substate. */ -export interface MigrationSubstateDetails { - /** - * Substate of migration. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly currentSubState?: MigrationSubstate; - /** Dictionary of */ - dbDetails?: { [propertyName: string]: DatabaseMigrationState }; - /** Details for the validation for migration. */ - validationDetails?: ValidationDetails; -} - -/** Migration state of a database. */ -export interface DatabaseMigrationState { - /** Name of database. */ - databaseName?: string; - /** Migration state of a database. */ - migrationState?: MigrationDatabaseState; - /** Migration operation of a database. */ - migrationOperation?: string; - /** Start time of a migration state. */ - startedOn?: Date; - /** End time of a migration state. */ - endedOn?: Date; - /** Number of tables queued for the migration of a database. */ - fullLoadQueuedTables?: number; - /** Number of tables encountering errors during the migration of a database. */ - fullLoadErroredTables?: number; - /** Number of tables loading during the migration of a database. */ - fullLoadLoadingTables?: number; - /** Number of tables loaded during the migration of a database. */ - fullLoadCompletedTables?: number; - /** Change Data Capture update counter. */ - cdcUpdateCounter?: number; - /** Change Data Capture delete counter. */ - cdcDeleteCounter?: number; - /** Change Data Capture insert counter. */ - cdcInsertCounter?: number; - /** Change Data Capture applied changes counter. */ - appliedChanges?: number; - /** Change Data Capture incoming changes counter. */ - incomingChanges?: number; - /** Lag in seconds between source and target during online phase. */ - latency?: number; - /** Error message, if any, for the migration state. */ - message?: string; -} - -/** Details for the validation for migration. */ -export interface ValidationDetails { - /** Validation status for migration. */ - status?: ValidationState; - /** Start time (UTC) for validation. */ - validationStartTimeInUtc?: Date; - /** End time (UTC) for validation. */ - validationEndTimeInUtc?: Date; - /** Details of server level validations. */ - serverLevelValidationDetails?: ValidationSummaryItem[]; - /** Details of server level validations. */ - dbLevelValidationDetails?: DbLevelValidationStatus[]; -} - -/** Validation summary object. */ -export interface ValidationSummaryItem { - /** Validation type. */ - type?: string; - /** Validation status for migration. */ - state?: ValidationState; - /** Validation messages. */ - messages?: ValidationMessage[]; -} - -/** Validation message object. */ -export interface ValidationMessage { - /** Severity of validation message. */ - state?: ValidationState; - /** Validation message string. */ - message?: string; -} - -/** Validation status summary for a database. */ -export interface DbLevelValidationStatus { - /** Name of database. */ - databaseName?: string; - /** Start time of a database level validation. */ - startedOn?: Date; - /** End time of a database level validation. */ - endedOn?: Date; - /** Summary of database level validations. */ - summary?: ValidationSummaryItem[]; -} - -/** Database server metadata. */ -export interface DbServerMetadata { - /** - * Location of database server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly location?: string; - /** Major version of PostgreSQL database engine. */ - version?: string; - /** Storage size (in MB) for database server. */ - storageMb?: number; - /** Compute tier and size of the database server. This object is empty for an Azure Database for PostgreSQL single server. */ - sku?: ServerSku; -} - -/** Compute information of a server. */ -export interface ServerSku { - /** Compute tier and size of the database server. This object is empty for an Azure Database for PostgreSQL single server. */ - name?: string; - /** Tier of the compute assigned to a server. */ - tier?: SkuTier; -} - -/** Migration secret parameters. */ -export interface MigrationSecretParameters { - /** Credentials of administrator users for source and target servers. */ - adminCredentials: AdminCredentials; - /** Gets or sets the name of the user for the source server. This user doesn't need to be an administrator. */ - sourceServerUsername?: string; - /** Gets or sets the name of the user for the target server. This user doesn't need to be an administrator. */ - targetServerUsername?: string; -} - -/** Credentials of administrator users for source and target servers. */ -export interface AdminCredentials { - /** Password for the user of the source server. */ - sourceServerPassword: string; - /** Password for the user of the target server. */ - targetServerPassword: string; -} - -/** Migration. */ -export interface MigrationResourceForPatch { - /** Application-specific metadata in the form of key-value pairs. */ - tags?: { [propertyName: string]: string }; - /** Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username. */ - sourceDbServerResourceId?: string; - /** Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server. */ - sourceDbServerFullyQualifiedDomainName?: string; - /** Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server. */ - targetDbServerFullyQualifiedDomainName?: string; - /** Migration secret parameters. */ - secretParameters?: MigrationSecretParametersForPatch; - /** Names of databases to migrate. */ - dbsToMigrate?: string[]; - /** Indicates whether to setup logical replication on source server, if needed. */ - setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; - /** Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation. */ - overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; - /** Start time (UTC) for migration window. */ - migrationWindowStartTimeInUtc?: Date; - /** Indicates if roles and permissions must be migrated. */ - migrateRoles?: MigrateRolesAndPermissions; - /** Indicates if data migration must start right away. */ - startDataMigration?: StartDataMigration; - /** Indicates if cutover must be triggered for the entire migration. */ - triggerCutover?: TriggerCutover; - /** When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ - dbsToTriggerCutoverOn?: string[]; - /** Indicates if cancel must be triggered for the entire migration. */ - cancel?: Cancel; - /** When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ - dbsToCancelMigrationOn?: string[]; - /** Mode used to perform the migration: Online or Offline. */ - migrationMode?: MigrationMode; -} - -/** Migration secret parameters. */ -export interface MigrationSecretParametersForPatch { - /** Credentials of administrator users for source and target servers. */ - adminCredentials?: AdminCredentialsForPatch; - /** Gets or sets the name of the user for the source server. This user doesn't need to be an administrator. */ - sourceServerUsername?: string; - /** Gets or sets the name of the user for the target server. This user doesn't need to be an administrator. */ - targetServerUsername?: string; -} - -/** Credentials of administrator users for source and target servers. */ -export interface AdminCredentialsForPatch { - /** Password for the user of the source server. */ - sourceServerPassword?: string; - /** Password for the user of the target server. */ - targetServerPassword?: string; -} - -/** List of migrations. */ -export interface MigrationList { - /** - * List of migrations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Migration[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** Availability of a migration name. */ -export interface MigrationNameAvailability { - /** Name of the migration to check for validity and availability. */ - name: string; - /** Type of resource. */ - type: string; - /** - * Indicates if the migration name is available. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nameAvailable?: boolean; - /** - * Migration name availability reason. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly reason?: MigrationNameAvailabilityReason; - /** - * Migration name availability message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; -} - -/** The check availability request body. */ -export interface CheckNameAvailabilityRequest { - /** The name of the resource for which availability needs to be checked. */ - name?: string; - /** The resource type. */ - type?: string; -} - -/** The check availability result. */ -export interface CheckNameAvailabilityResponse { - /** Indicates if the resource name is available. */ - nameAvailable?: boolean; - /** The reason why the given name is not available. */ - reason?: CheckNameAvailabilityReason; - /** Detailed reason why the given name is available. */ - message?: string; -} - -/** List of resource provider operations. */ -export interface OperationList { - /** Collection of available operation details */ - value?: Operation[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** REST API operation definition. */ -export interface Operation { - /** - * Name of the operation being performed on this particular object. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Localized display information for this particular operation or action. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly display?: OperationDisplay; - /** Indicates if the operation is a data action. */ - isDataAction?: boolean; - /** - * Intended executor of the operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly origin?: OperationOrigin; - /** - * Additional descriptions for the operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly properties?: { [propertyName: string]: Record }; -} - -/** Display metadata associated with the operation. */ -export interface OperationDisplay { - /** - * Name of the resource provider. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provider?: string; - /** - * Type of resource on which the operation is performed. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resource?: string; - /** - * Name of the operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly operation?: string; - /** - * Description of the operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; -} - -/** The private endpoint resource. */ -export interface PrivateEndpoint { - /** - * The ARM identifier for private endpoint. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; -} - -/** 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; -} - -/** List of private endpoint connections. */ -export interface PrivateEndpointConnectionList { - /** - * Array of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: PrivateEndpointConnection[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** A list of private link resources */ -export interface PrivateLinkResourceList { - /** - * Array of results. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: PrivateLinkResource[]; - /** Link to retrieve next page of results. */ - nextLink?: string; -} - -/** Capability for the PostgreSQL server */ -export interface QuotaUsageList { - /** - * A list of quota usages. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: QuotaUsage[]; - /** Link to retrieve next page of results. */ - nextLink?: string; -} - -/** Quota usage for servers */ -export interface QuotaUsage { - /** Name of quota usage for servers */ - name?: NameProperty; - /** Quota limit */ - limit?: number; - /** Quota unit */ - unit?: string; - /** Current Quota usage value */ - currentValue?: number; - /** Fully qualified ARM resource Id */ - id?: string; -} - -/** Name property for quota usage */ -export interface NameProperty { - /** Name value */ - value?: string; - /** Localized name */ - localizedValue?: string; -} - -/** A list of servers. */ -export interface ServerList { - /** The list of servers */ - value?: Server[]; - /** The link used to get the next page of operations. */ - nextLink?: string; -} - -/** Compute information of a server. */ -export interface Sku { - /** Name by which is known a given compute size assigned to a server. */ - name: string; - /** Tier of the compute assigned to a server. */ - tier: SkuTier; -} - -/** Identities associated with a server. */ -export interface UserAssignedIdentity { - /** Map of user assigned managed identities. */ - userAssignedIdentities?: { [propertyName: string]: UserIdentity }; - /** Identifier of the object of the service principal associated to the user assigned managed identity. */ - principalId?: string; - /** Types of identities associated with a server. */ - type: IdentityType; - /** - * Identifier of the tenant of a server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly tenantId?: string; -} - -/** User assigned managed identity associated with a server. */ -export interface UserIdentity { - /** Identifier of the object of the service principal associated to the user assigned managed identity. */ - principalId?: string; - /** Identifier of the client of the service principal associated to the user assigned managed identity. */ - clientId?: string; -} - -/** Storage properties of a server. */ -export interface Storage { - /** Size of storage assigned to a server. */ - storageSizeGB?: number; - /** Flag to enable or disable the automatic growth of storage size of a server when available space is nearing zero and conditions allow for automatically growing storage size. */ - autoGrow?: StorageAutoGrow; - /** Storage tier of a server. */ - tier?: AzureManagedDiskPerformanceTier; - /** Maximum IOPS supported for storage. Required when type of storage is PremiumV2_LRS or UltraSSD_LRS. */ - iops?: number; - /** Maximum throughput supported for storage. Required when type of storage is PremiumV2_LRS or UltraSSD_LRS. */ - throughput?: number; - /** Type of storage assigned to a server. Allowed values are Premium_LRS, PremiumV2_LRS, or UltraSSD_LRS. If not specified, it defaults to Premium_LRS. */ - type?: StorageType; -} - -/** Authentication configuration properties of a server. */ -export interface AuthConfig { - /** Indicates if the server supports Microsoft Entra authentication. */ - activeDirectoryAuth?: MicrosoftEntraAuth; - /** Indicates if the server supports password based authentication. */ - passwordAuth?: PasswordBasedAuth; - /** Identifier of the tenant of the delegated resource. */ - tenantId?: string; -} - -/** Data encryption properties of a server. */ -export interface DataEncryption { - /** URI of the key in Azure Key Vault used for data encryption of the primary storage associated to a server. */ - primaryKeyURI?: string; - /** Identifier of the user assigned managed identity used to access the key in Azure Key Vault for data encryption of the primary storage associated to a server. */ - primaryUserAssignedIdentityId?: string; - /** Identifier of the user assigned managed identity used to access the key in Azure Key Vault for data encryption of the geographically redundant storage associated to a server that is configured to support geographically redundant backups. */ - geoBackupKeyURI?: string; - /** Identifier of the user assigned managed identity used to access the key in Azure Key Vault for data encryption of the geographically redundant storage associated to a server that is configured to support geographically redundant backups. */ - geoBackupUserAssignedIdentityId?: string; - /** Data encryption type used by a server. */ - type?: DataEncryptionType; - /** Status of key used by a server configured with data encryption based on customer managed key, to encrypt the primary storage associated to the server. */ - primaryEncryptionKeyStatus?: EncryptionKeyStatus; - /** Status of key used by a server configured with data encryption based on customer managed key, to encrypt the geographically redundant storage associated to the server when it is configured to support geographically redundant backups. */ - geoBackupEncryptionKeyStatus?: EncryptionKeyStatus; -} - -/** Backup properties of a server. */ -export interface Backup { - /** Backup retention days for the server. */ - backupRetentionDays?: number; - /** Indicates if the server is configured to create geographically redundant backups. */ - geoRedundantBackup?: GeographicallyRedundantBackup; - /** - * Earliest restore point time (ISO8601 format) for a server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly earliestRestoreDate?: Date; -} - -/** Network properties of a server. */ -export interface Network { - /** Indicates if public network access is enabled or not. This is only supported for servers that are not integrated into a virtual network which is owned and provided by customer when server is deployed. */ - publicNetworkAccess?: ServerPublicNetworkAccessState; - /** Resource identifier of the delegated subnet. Required during creation of a new server, in case you want the server to be integrated into your own virtual network. For an update operation, you only have to provide this property if you want to change the value assigned for the private DNS zone. */ - delegatedSubnetResourceId?: string; - /** Identifier of the private DNS zone. Required during creation of a new server, in case you want the server to be integrated into your own virtual network. For an update operation, you only have to provide this property if you want to change the value assigned for the private DNS zone. */ - privateDnsZoneArmResourceId?: string; -} - -/** High availability properties of a server. */ -export interface HighAvailability { - /** High availability mode for a server. */ - mode?: HighAvailabilityMode; - /** - * Possible states of the standby server created when high availability is set to SameZone or ZoneRedundant. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly state?: HighAvailabilityState; - /** Availability zone associated to the standby server created when high availability is set to SameZone or ZoneRedundant. */ - standbyAvailabilityZone?: string; -} - -/** Maintenance window properties of a server. */ -export interface MaintenanceWindow { - /** Indicates whether custom window is enabled or disabled. */ - customWindow?: string; - /** Start hour to be used for maintenance window. */ - startHour?: number; - /** Start minute to be used for maintenance window. */ - startMinute?: number; - /** Day of the week to be used for maintenance window. */ - dayOfWeek?: number; -} - -/** Replica properties of a server. */ -export interface Replica { - /** Role of the server in a replication set. */ - role?: ReplicationRole; - /** - * Maximum number of read replicas allowed for a server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly capacity?: number; - /** - * Indicates the replication state of a read replica. This property is returned only when the target server is a read replica. Possible values are Active, Broken, Catchup, Provisioning, Reconfiguring, and Updating - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly replicationState?: ReplicationState; - /** Type of operation to apply on the read replica. This property is write only. Standalone means that the read replica will be promoted to a standalone server, and will become a completely independent entity from the replication set. Switchover means that the read replica will roles with the primary server. */ - promoteMode?: ReadReplicaPromoteMode; - /** Data synchronization option to use when processing the operation specified in the promoteMode property. This property is write only. */ - promoteOption?: ReadReplicaPromoteOption; -} - -/** Cluster properties of a server. */ -export interface Cluster { - /** Number of nodes assigned to the elastic cluster. */ - clusterSize?: number; - /** Default database name for the elastic cluster. */ - defaultDatabaseName?: string; -} - -/** Represents a server to be updated. */ -export interface ServerForPatch { - /** Compute tier and size of a server. */ - sku?: SkuForPatch; - /** Describes the identity of the application. */ - identity?: UserAssignedIdentity; - /** Application-specific metadata in the form of key-value pairs. */ - tags?: { [propertyName: string]: string }; - /** Name of the login designated as the first password based administrator assigned to your instance of PostgreSQL. Must be specified the first time that you enable password based authentication on a server. Once set to a given value, it cannot be changed for the rest of the life of a server. If you disable password based authentication on a server which had it enabled, this password based role isn't deleted. */ - administratorLogin?: string; - /** - * Password assigned to the administrator login. As long as password authentication is enabled, this password can be changed at any time. - * This value contains a credential. Consider obscuring before showing to users - */ - administratorLoginPassword?: string; - /** Major version of PostgreSQL database engine. */ - version?: PostgresMajorVersion; - /** Storage properties of a server. */ - storage?: Storage; - /** Backup properties of a server. */ - backup?: BackupForPatch; - /** High availability properties of a server. */ - highAvailability?: HighAvailabilityForPatch; - /** Maintenance window properties of a server. */ - maintenanceWindow?: MaintenanceWindowForPatch; - /** Authentication configuration properties of a server. */ - authConfig?: AuthConfigForPatch; - /** Data encryption properties of a server. */ - dataEncryption?: DataEncryption; - /** Availability zone of a server. */ - availabilityZone?: string; - /** Update mode of an existing server. */ - createMode?: CreateModeForPatch; - /** Role of the server in a replication set. */ - replicationRole?: ReplicationRole; - /** Read replica properties of a server. Required only in case that you want to promote a server. */ - replica?: Replica; - /** Network properties of a server. Only required if you want your server to be integrated into a virtual network provided by customer. */ - network?: Network; - /** Cluster properties of a server. */ - cluster?: Cluster; -} - -/** Compute information of a server. */ -export interface SkuForPatch { - /** Name by which is known a given compute size assigned to a server. */ - name?: string; - /** Tier of the compute assigned to a server. */ - tier?: SkuTier; -} - -/** Backup properties of a server. */ -export interface BackupForPatch { - /** Backup retention days for the server. */ - backupRetentionDays?: number; - /** Indicates if the server is configured to create geographically redundant backups. */ - geoRedundantBackup?: GeographicallyRedundantBackup; - /** - * Earliest restore point time (ISO8601 format) for a server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly earliestRestoreDate?: Date; -} - -/** High availability properties of a server. */ -export interface HighAvailabilityForPatch { - /** High availability mode for a server. */ - mode?: HighAvailabilityMode; - /** - * Possible states of the standby server created when high availability is set to SameZone or ZoneRedundant. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly state?: HighAvailabilityState; - /** Availability zone associated to the standby server created when high availability is set to SameZone or ZoneRedundant. */ - standbyAvailabilityZone?: string; -} - -/** Maintenance window properties of a server. */ -export interface MaintenanceWindowForPatch { - /** Indicates whether custom window is enabled or disabled. */ - customWindow?: string; - /** Start hour to be used for maintenance window. */ - startHour?: number; - /** Start minute to be used for maintenance window. */ - startMinute?: number; - /** Day of the week to be used for maintenance window. */ - dayOfWeek?: number; -} - -/** Authentication configuration properties of a server. */ -export interface AuthConfigForPatch { - /** Indicates if the server supports Microsoft Entra authentication. */ - activeDirectoryAuth?: MicrosoftEntraAuth; - /** Indicates if the server supports password based authentication. */ - passwordAuth?: PasswordBasedAuth; - /** Identifier of the tenant of the delegated resource. */ - tenantId?: string; -} - -/** PostgreSQL database engine restart parameters. */ -export interface RestartParameter { - /** Indicates if restart the PostgreSQL database engine should failover or switch over from primary to standby. This only works if server has high availability enabled. */ - restartWithFailover?: boolean; - /** Failover mode. */ - failoverMode?: FailoverMode; -} - -/** List of available object recommendations. */ -export interface ObjectRecommendationList { - /** List of available object recommendations. */ - value?: ObjectRecommendation[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** Implementation details for the recommended action. */ -export interface ObjectRecommendationPropertiesImplementationDetails { - /** Method of implementation for recommended action. */ - method?: string; - /** Implementation script for the recommended action. */ - script?: string; -} - -/** Workload information for the recommended action. */ -export interface ObjectRecommendationPropertiesAnalyzedWorkload { - /** Start time (UTC) of the workload analyzed. */ - startTime?: Date; - /** End time (UTC) of the workload analyzed. */ - endTime?: Date; - /** Number of queries from the workload that were examined to produce this recommendation. For DROP INDEX recommendations it's 0 (zero). */ - queryCount?: number; -} - -/** Impact on some metric if this recommended action is applied. */ -export interface ImpactRecord { - /** Dimension name. */ - dimensionName?: string; - /** Dimension unit. */ - unit?: string; - /** Optional property that can be used to store the identifier of the query, if the metric is for a specific query. */ - queryId?: number; - /** Absolute value. */ - absoluteValue?: number; -} - -/** Recommendation details for the recommended action. */ -export interface ObjectRecommendationDetails { - /** Database name. */ - databaseName?: string; - /** Schema name. */ - schema?: string; - /** Table name. */ - table?: string; - /** Index type. */ - indexType?: string; - /** Index name. */ - indexName?: string; - /** Index columns. */ - indexColumns?: string[]; - /** Index included columns. */ - includedColumns?: string[]; -} - -/** List of server tuning options. */ -export interface TuningOptionsList { - /** List of available tuning options. */ - value?: TuningOptions[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** Pair of virtual endpoints for a server. */ -export interface VirtualEndpointResourceForPatch { - /** Type of endpoint for the virtual endpoints. */ - endpointType?: VirtualEndpointType; - /** List of servers that one of the virtual endpoints can refer to. */ - members?: string[]; - /** - * List of virtual endpoints for a server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly virtualEndpoints?: string[]; -} - -/** List of virtual endpoints. */ -export interface VirtualEndpointsList { - /** List of virtual endpoints. */ - value?: VirtualEndpoint[]; - /** Link used to get the next page of results. */ - nextLink?: string; -} - -/** Virtual network subnet usage parameter */ -export interface VirtualNetworkSubnetUsageParameter { - /** Virtual network resource id. */ - virtualNetworkArmResourceId?: string; -} - -/** Virtual network subnet usage data. */ -export interface VirtualNetworkSubnetUsageModel { - /** NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly delegatedSubnetsUsage?: DelegatedSubnetUsage[]; - /** - * location of the delegated subnet usage - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly location?: string; - /** - * subscriptionId of the delegated subnet usage - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly subscriptionId?: string; -} - -/** Delegated subnet usage data. */ -export interface DelegatedSubnetUsage { - /** - * Name of the delegated subnet for which IP addresses are in use - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly subnetName?: string; - /** - * Number of IP addresses used by the delegated subnet - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly usage?: number; -} - -/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export interface ProxyResource extends Resource {} - -/** 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?: { [propertyName: string]: string }; - /** The geo-location where the resource lives */ - location: string; -} - -/** The private endpoint connection resource. */ -export interface PrivateEndpointConnection extends Resource { - /** - * The group ids for the private endpoint resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly groupIds?: string[]; - /** The private endpoint resource. */ - privateEndpoint?: PrivateEndpoint; - /** A collection of information about the state of the connection between service consumer and provider. */ - privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; - /** - * The provisioning state of the private endpoint connection resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: PrivateEndpointConnectionProvisioningState; -} - -/** A private link resource. */ -export interface PrivateLinkResource extends Resource { - /** - * The private link resource group id. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly groupId?: string; - /** - * The private link resource required member names. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly requiredMembers?: string[]; - /** The private link resource private link DNS zone name. */ - requiredZoneNames?: string[]; -} - -/** Pair of virtual endpoints for a server. */ -export interface VirtualEndpoint extends VirtualEndpointResourceForPatch, Resource {} - -/** Capability of a storage tier. */ -export interface StorageTierCapability extends CapabilityBase { - /** - * Name of the storage tier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Supported IOPS for the storage tier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly iops?: number; -} - -/** Storage size (in MB) capability. */ -export interface StorageMbCapability extends CapabilityBase { - /** - * Minimum IOPS supported by the storage size. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedIops?: number; - /** - * Maximum IOPS supported by the storage size. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedMaximumIops?: number; - /** - * Minimum supported size (in MB) of storage. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly storageSizeMb?: number; - /** - * Maximum supported size (in MB) of storage. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly maximumStorageSizeMb?: number; - /** - * Minimum supported throughput (in MB/s) of storage. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedThroughput?: number; - /** - * Maximum supported throughput (in MB/s) of storage. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedMaximumThroughput?: number; - /** - * Default IOPS for this tier and storage size. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly defaultIopsTier?: string; - /** - * List of all supported storage tiers for this tier and storage size. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedIopsTiers?: StorageTierCapability[]; -} - -/** Capabilities in terms of storage tier. */ -export interface StorageEditionCapability extends CapabilityBase { - /** - * Name of storage tier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Default storage size (in MB) for this storage tier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly defaultStorageSizeMb?: number; - /** - * Configurations of storage supported for this storage tier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedStorageMb?: StorageMbCapability[]; -} - -/** Capabilities in terms of compute. */ -export interface ServerSkuCapability extends CapabilityBase { - /** - * Name of the compute (SKU). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * vCores available for this compute. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly vCores?: number; - /** - * Maximum IOPS supported by this compute. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedIops?: number; - /** - * Supported memory (in MB) per virtual core assigned to this compute. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedMemoryPerVcoreMb?: number; - /** - * List of supported availability zones. E.g. '1', '2', '3' - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedZones?: string[]; - /** - * Modes of high availability supported for this compute. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedHaMode?: HighAvailabilityMode[]; - /** - * Features supported. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedFeatures?: SupportedFeature[]; - /** - * Security profile of the compute. Indicates if it's a Confidential Compute virtual machine. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly securityProfile?: string; -} - -/** Capabilities in terms of compute tier. */ -export interface ServerEditionCapability extends CapabilityBase { - /** - * Name of compute tier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Default compute name (SKU) for this computer tier. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly defaultSkuName?: string; - /** - * List of storage editions supported by this compute tier and compute name. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedStorageEditions?: StorageEditionCapability[]; - /** - * List of supported compute names (SKUs). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedServerSkus?: ServerSkuCapability[]; -} - -/** Capabilities in terms of major versions of PostgreSQL database engine. */ -export interface ServerVersionCapability extends CapabilityBase { - /** - * Major version of PostgreSQL database engine. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Major versions of PostgreSQL database engine to which this version can be automatically upgraded. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedVersionsToUpgrade?: string[]; - /** - * Features supported. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedFeatures?: SupportedFeature[]; -} - -/** Capability of a fast provisioning compute tier. */ -export interface FastProvisioningEditionCapability extends CapabilityBase { - /** - * Compute tier supporting fast provisioning. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedTier?: string; - /** - * Compute name (SKU) supporting fast provisioning. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedSku?: string; - /** - * Storage size (in GB) supporting fast provisioning. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedStorageGb?: number; - /** - * Major version of PostgreSQL database engine supporting fast provisioning. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedServerVersions?: string; - /** - * Count of servers in cache matching this specification. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly serverCount?: number; -} - -/** Capability for the Azure Database for PostgreSQL flexible server. */ -export interface Capability extends CapabilityBase { - /** Name of flexible servers capabilities. */ - name?: string; - /** - * List of supported compute tiers. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedServerEditions?: ServerEditionCapability[]; - /** - * List of supported major versions of PostgreSQL database engine. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedServerVersions?: ServerVersionCapability[]; - /** - * Features supported. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedFeatures?: SupportedFeature[]; - /** - * Indicates if fast provisioning is supported. 'Enabled' means fast provisioning is supported. 'Disabled' stands for fast provisioning is not supported. Will be deprecated in the future. Look to Supported Features for 'FastProvisioning'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly fastProvisioningSupported?: FastProvisioningSupport; - /** - * List of compute tiers supporting fast provisioning. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly supportedFastProvisioningEditions?: FastProvisioningEditionCapability[]; - /** - * Indicates if geographically redundant backups are supported in this location. 'Enabled' means geographically redundant backups are supported. 'Disabled' stands for geographically redundant backup is not supported. Will be deprecated in the future. Look to Supported Features for 'GeoBackup'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly geoBackupSupported?: GeographicallyRedundantBackupSupport; - /** - * Indicates if high availability with zone redundancy is supported in this location. 'Enabled' means high availability with zone redundancy is supported. 'Disabled' stands for high availability with zone redundancy is not supported. Will be deprecated in the future. Look to Supported Features for 'ZoneRedundantHa'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly zoneRedundantHaSupported?: ZoneRedundantHighAvailabilitySupport; - /** - * Indicates if high availability with zone redundancy is supported in conjunction with geographically redundant backups in this location. 'Enabled' means high availability with zone redundancy is supported in conjunction with geographically redundant backups is supported. 'Disabled' stands for high availability with zone redundancy is supported in conjunction with geographically redundant backups is not supported. Will be deprecated in the future. Look to Supported Features for 'ZoneRedundantHaAndGeoBackup'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly zoneRedundantHaAndGeoBackupSupported?: ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport; - /** - * Indicates if storage autogrow is supported in this location. 'Enabled' means storage autogrow is supported. 'Disabled' stands for storage autogrow is not supported. Will be deprecated in the future. Look to Supported Features for 'StorageAutoGrowth'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly storageAutoGrowthSupported?: StorageAutoGrowthSupport; - /** - * Indicates if resizing the storage, without interrupting the operation of the database engine, is supported in this location for the given subscription. 'Enabled' means resizing the storage without interrupting the operation of the database engine is supported. 'Disabled' means resizing the storage without interrupting the operation of the database engine is not supported. Will be deprecated in the future. Look to Supported Features for 'OnlineResize'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly onlineResizeSupported?: OnlineStorageResizeSupport; - /** - * Indicates if this location is restricted. 'Enabled' means location is restricted. 'Disabled' stands for location is not restricted. Will be deprecated in the future. Look to Supported Features for 'Restricted'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly restricted?: LocationRestricted; -} - -/** A request that is made for pre-backup. */ -export interface LtrPreBackupRequest extends BackupRequestBase {} - -/** The request that is made for a long term retention backup. */ -export interface BackupsLongTermRetentionRequest extends BackupRequestBase { - /** Backup store detail for target server */ - targetDetails: BackupStoreDetails; -} - -/** Availability of a name. */ -export interface NameAvailabilityModel extends CheckNameAvailabilityResponse { - /** - * Name for which validity and availability was checked. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Type of resource. It can be 'Microsoft.DBforPostgreSQL/flexibleServers' or 'Microsoft.DBforPostgreSQL/flexibleServers/virtualendpoints'. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; -} - -/** Server administrator associated to a Microsoft Entra principal. */ -export interface AdministratorMicrosoftEntra extends ProxyResource { - /** Type of Microsoft Entra principal to which the server administrator is associated. */ - principalType?: PrincipalType; - /** Name of the Microsoft Entra principal. */ - principalName?: string; - /** Object identifier of the Microsoft Entra principal. */ - objectId?: string; - /** Identifier of the tenant in which the Microsoft Entra principal exists. */ - tenantId?: string; -} - -/** Advanced threat protection settings of the server. */ -export interface AdvancedThreatProtectionSettingsModel extends ProxyResource { - /** Specifies the state of the advanced threat protection, whether it is enabled, disabled, or a state has not been applied yet on the server. */ - state?: ThreatProtectionState; - /** - * Specifies the creation time (UTC) of the policy. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly creationTime?: Date; -} - -/** Properties of a backup. */ -export interface BackupAutomaticAndOnDemand extends ProxyResource { - /** Type of backup. */ - backupType?: BackupType; - /** Time(ISO8601 format) at which the backup was completed. */ - completedTime?: Date; - /** Source of the backup. */ - source?: string; -} - -/** Log file. */ -export interface CapturedLog extends ProxyResource { - /** Creation timestamp of the log file. */ - createdTime?: Date; - /** Last modified timestamp of the log file. */ - lastModifiedTime?: Date; - /** Size (in KB) of the log file. */ - sizeInKb?: number; - /** Type of log file. Can be 'ServerLogs' or 'UpgradeLogs'. */ - typePropertiesType?: string; - /** URL to download the log file from. */ - url?: string; -} - -/** Configuration (also known as server parameter). */ -export interface Configuration extends ProxyResource { - /** Value of the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ - value?: string; - /** - * Description of the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; - /** - * Value assigned by default to the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly defaultValue?: string; - /** - * Data type of the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly dataType?: ConfigurationDataType; - /** - * Allowed values of the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly allowedValues?: string; - /** Source of the value assigned to the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ - source?: string; - /** - * Indicates if it's a dynamic (true) or static (false) configuration (also known as server parameter). Static server parameters require a server restart after changing the value assigned to them, for the change to take effect. Dynamic server parameters do not require a server restart after changing the value assigned to them, for the change to take effect. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isDynamicConfig?: boolean; - /** - * Indicates if it's a read-only (true) or modifiable (false) configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isReadOnly?: boolean; - /** - * Indicates if the value assigned to the configuration (also known as server parameter) is pending a server restart for it to take effect. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isConfigPendingRestart?: boolean; - /** - * Units in which the configuration (also known as server parameter) value is expressed. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly unit?: string; - /** - * Link pointing to the documentation of the configuration (also known as server parameter). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly documentationLink?: string; -} - -/** Represents a database. */ -export interface Database extends ProxyResource { - /** Character set of the database. */ - charset?: string; - /** Collation of the database. */ - collation?: string; -} - -/** Firewall rule. */ -export interface FirewallRule extends ProxyResource { - /** IP address defining the start of the range of addresses of a firewall rule. Must be expressed in IPv4 format. */ - startIpAddress: string; - /** IP address defining the end of the range of addresses of a firewall rule. Must be expressed in IPv4 format. */ - endIpAddress: string; -} - -/** Response for the LTR backup Operation API call */ -export interface BackupsLongTermRetentionOperation extends ProxyResource { - /** Size of datasource in bytes */ - datasourceSizeInBytes?: number; - /** Data transferred in bytes */ - dataTransferredInBytes?: number; - /** Name of Backup operation */ - backupName?: string; - /** Metadata to be stored in RP. Store everything that will be required to perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc */ - backupMetadata?: string; - /** Service-set extensible enum indicating the status of operation */ - status?: ExecutionStatus; - /** Start time of the operation. */ - startTime?: Date; - /** End time of the operation. */ - endTime?: Date; - /** PercentageCompleted */ - percentComplete?: number; - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly errorCode?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly errorMessage?: string; -} - -/** Impact on some metric if this recommended action is applied. */ -export interface TuningOptions extends ProxyResource {} - -/** Object recommendation properties. */ -export interface ObjectRecommendation extends ProxyResource { - /** Always empty. */ - kind?: string; - /** Creation time (UTC) of this recommendation. */ - initialRecommendedTime?: Date; - /** Last time (UTC) that this recommendation was produced. */ - lastRecommendedTime?: Date; - /** Number of times this recommendation has been produced. */ - timesRecommended?: number; - /** List of identifiers for all queries identified as targets for improvement if the recommendation is applied. The list is only populated for CREATE INDEX recommendations. */ - improvedQueryIds?: number[]; - /** Reason for this recommendation. */ - recommendationReason?: string; - /** Current state. */ - currentState?: string; - /** Type for this recommendation. */ - recommendationType?: RecommendationTypeEnum; - /** Implementation details for the recommended action. */ - implementationDetails?: ObjectRecommendationPropertiesImplementationDetails; - /** Workload information for the recommended action. */ - analyzedWorkload?: ObjectRecommendationPropertiesAnalyzedWorkload; - /** - * Estimated impact of this recommended action. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly estimatedImpact?: ImpactRecord[]; - /** - * Recommendation details for the recommended action. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: ObjectRecommendationDetails; -} - -/** Properties of a migration. */ -export interface Migration extends TrackedResource { - /** - * Identifier of a migration. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly migrationId?: string; - /** - * Current status of a migration. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly currentStatus?: MigrationStatus; - /** Identifier of the private endpoint migration instance. */ - migrationInstanceResourceId?: string; - /** Mode used to perform the migration: Online or Offline. */ - migrationMode?: MigrationMode; - /** Supported option for a migration. */ - migrationOption?: MigrationOption; - /** Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL */ - sourceType?: SourceType; - /** SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is 'VerifyFull'. Default SSL mode for other source types is 'Prefer'. */ - sslMode?: SslMode; - /** - * Metadata of source database server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly sourceDbServerMetadata?: DbServerMetadata; - /** - * Metadata of target database server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly targetDbServerMetadata?: DbServerMetadata; - /** Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username. */ - sourceDbServerResourceId?: string; - /** Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server. */ - sourceDbServerFullyQualifiedDomainName?: string; - /** - * Identifier of the target database server resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly targetDbServerResourceId?: string; - /** Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server. */ - targetDbServerFullyQualifiedDomainName?: string; - /** Migration secret parameters. */ - secretParameters?: MigrationSecretParameters; - /** Names of databases to migrate. */ - dbsToMigrate?: string[]; - /** Indicates whether to setup logical replication on source server, if needed. */ - setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; - /** Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation. */ - overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; - /** Start time (UTC) for migration window. */ - migrationWindowStartTimeInUtc?: Date; - /** End time (UTC) for migration window. */ - migrationWindowEndTimeInUtc?: Date; - /** Indicates if roles and permissions must be migrated. */ - migrateRoles?: MigrateRolesAndPermissions; - /** Indicates if data migration must start right away. */ - startDataMigration?: StartDataMigration; - /** Indicates if cutover must be triggered for the entire migration. */ - triggerCutover?: TriggerCutover; - /** When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ - dbsToTriggerCutoverOn?: string[]; - /** Indicates if cancel must be triggered for the entire migration. */ - cancel?: Cancel; - /** When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ - dbsToCancelMigrationOn?: string[]; -} - -/** Properties of a server. */ -export interface Server extends TrackedResource { - /** Compute tier and size of a server. */ - sku?: Sku; - /** User assigned managed identities assigned to the server. */ - identity?: UserAssignedIdentity; - /** Name of the login designated as the first password based administrator assigned to your instance of PostgreSQL. Must be specified the first time that you enable password based authentication on a server. Once set to a given value, it cannot be changed for the rest of the life of a server. If you disable password based authentication on a server which had it enabled, this password based role isn't deleted. */ - administratorLogin?: string; - /** - * Password assigned to the administrator login. As long as password authentication is enabled, this password can be changed at any time. - * This value contains a credential. Consider obscuring before showing to users - */ - administratorLoginPassword?: string; - /** Major version of PostgreSQL database engine. */ - version?: PostgresMajorVersion; - /** - * Minor version of PostgreSQL database engine. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly minorVersion?: string; - /** - * Possible states of a server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly state?: ServerState; - /** - * Fully qualified domain name of a server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly fullyQualifiedDomainName?: string; - /** Storage properties of a server. */ - storage?: Storage; - /** Authentication configuration properties of a server. */ - authConfig?: AuthConfig; - /** Data encryption properties of a server. */ - dataEncryption?: DataEncryption; - /** Backup properties of a server. */ - backup?: Backup; - /** Network properties of a server. Only required if you want your server to be integrated into a virtual network provided by customer. */ - network?: Network; - /** High availability properties of a server. */ - highAvailability?: HighAvailability; - /** Maintenance window properties of a server. */ - maintenanceWindow?: MaintenanceWindow; - /** Identifier of the server to be used as the source of the new server. Required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', 'Replica', or 'ReviveDropped'. This property is returned only when the target server is a read replica. */ - sourceServerResourceId?: string; - /** Creation time (in ISO8601 format) of the backup which you want to restore in the new server. It's required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', or 'ReviveDropped'. */ - pointInTimeUTC?: Date; - /** Availability zone of a server. */ - availabilityZone?: string; - /** Role of the server in a replication set. */ - replicationRole?: ReplicationRole; - /** - * Maximum number of read replicas allowed for a server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly replicaCapacity?: number; - /** Read replica properties of a server. Required only in case that you want to promote a server. */ - replica?: Replica; - /** Creation mode of a new server. */ - createMode?: CreateMode; - /** - * List of private endpoint connections associated with the specified server. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly privateEndpointConnections?: PrivateEndpointConnection[]; - /** Cluster properties of a server. */ - cluster?: Cluster; -} - -/** Defines headers for AdministratorsMicrosoftEntra_createOrUpdate operation. */ -export interface AdministratorsMicrosoftEntraCreateOrUpdateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for AdministratorsMicrosoftEntra_delete operation. */ -export interface AdministratorsMicrosoftEntraDeleteHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for ServerThreatProtectionSettings_createOrUpdate operation. */ -export interface ServerThreatProtectionSettingsCreateOrUpdateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for BackupsAutomaticAndOnDemand_create operation. */ -export interface BackupsAutomaticAndOnDemandCreateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for BackupsAutomaticAndOnDemand_delete operation. */ -export interface BackupsAutomaticAndOnDemandDeleteHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Configurations_update operation. */ -export interface ConfigurationsUpdateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Configurations_put operation. */ -export interface ConfigurationsPutHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Databases_create operation. */ -export interface DatabasesCreateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Databases_delete operation. */ -export interface DatabasesDeleteHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for FirewallRules_createOrUpdate operation. */ -export interface FirewallRulesCreateOrUpdateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for FirewallRules_delete operation. */ -export interface FirewallRulesDeleteHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for BackupsLongTermRetention_checkPrerequisites operation. */ -export interface BackupsLongTermRetentionCheckPrerequisitesHeaders { - /** A unique ID for the current operation, service generated. All the resource providers must return this value in the response headers to facilitate debugging. */ - xMsRequestId?: string; -} - -/** Defines headers for BackupsLongTermRetention_checkPrerequisites operation. */ -export interface BackupsLongTermRetentionCheckPrerequisitesExceptionHeaders { - /** ErrorCode string in the event of a failure. */ - xMsErrorCode?: string; - /** A unique ID for the current operation, service generated. All the resource providers must return this value in the response headers to facilitate debugging. */ - xMsRequestId?: string; -} - -/** Defines headers for BackupsLongTermRetention_start operation. */ -export interface BackupsLongTermRetentionStartHeaders { - /** A unique ID for the current operation, service generated. All the resource providers must return this value in the response headers to facilitate debugging. */ - xMsRequestId?: string; -} - -/** Defines headers for BackupsLongTermRetention_start operation. */ -export interface BackupsLongTermRetentionStartExceptionHeaders { - /** ErrorCode string in the event of a failure. */ - xMsErrorCode?: string; - /** A unique ID for the current operation, service generated. All the resource providers must return this value in the response headers to facilitate debugging. */ - xMsRequestId?: string; -} - -/** Defines headers for PrivateEndpointConnections_update operation. */ -export interface PrivateEndpointConnectionsUpdateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for PrivateEndpointConnections_delete operation. */ -export interface PrivateEndpointConnectionsDeleteHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Servers_createOrUpdate operation. */ -export interface ServersCreateOrUpdateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Servers_update operation. */ -export interface ServersUpdateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Servers_delete operation. */ -export interface ServersDeleteHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Servers_restart operation. */ -export interface ServersRestartHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Servers_start operation. */ -export interface ServersStartHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for Servers_stop operation. */ -export interface ServersStopHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for VirtualEndpoints_create operation. */ -export interface VirtualEndpointsCreateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for VirtualEndpoints_update operation. */ -export interface VirtualEndpointsUpdateHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Defines headers for VirtualEndpoints_delete operation. */ -export interface VirtualEndpointsDeleteHeaders { - location?: string; - azureAsyncOperation?: string; -} - -/** Known values of {@link PrincipalType} that the service accepts. */ -export enum KnownPrincipalType { - /** The principal type is not known or not specified. */ - Unknown = "Unknown", - /** A Microsoft Entra user. */ - User = "User", - /** A Microsoft Entra group. */ - Group = "Group", - /** A Microsoft Entra service principal, typically representing an application or service identity */ - ServicePrincipal = "ServicePrincipal", -} - -/** - * Defines values for PrincipalType. \ - * {@link KnownPrincipalType} can be used interchangeably with PrincipalType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Unknown**: The principal type is not known or not specified. \ - * **User**: A Microsoft Entra user. \ - * **Group**: A Microsoft Entra group. \ - * **ServicePrincipal**: A Microsoft Entra service principal, typically representing an application or service identity - */ -export type PrincipalType = string; - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key", -} - -/** - * Defines values for CreatedByType. \ - * {@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** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** Known values of {@link ThreatProtectionName} that the service accepts. */ -export enum KnownThreatProtectionName { - /** Default advanced threat protection settings. */ - Default = "Default", -} - -/** - * Defines values for ThreatProtectionName. \ - * {@link KnownThreatProtectionName} can be used interchangeably with ThreatProtectionName, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Default**: Default advanced threat protection settings. - */ -export type ThreatProtectionName = string; - -/** Known values of {@link BackupType} that the service accepts. */ -export enum KnownBackupType { - /** A full backup taken automatically by the service. These backups are retained for a period of time as defined by the backup retention policy, and they cannot be deleted by the customer. */ - Full = "Full", - /** A full backup triggered by the customer. These backups are retained for a period of time as defined by the backup retention policy, and they can also be deleted by the customer. */ - CustomerOnDemand = "Customer On-Demand", -} - -/** - * Defines values for BackupType. \ - * {@link KnownBackupType} can be used interchangeably with BackupType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Full**: A full backup taken automatically by the service. These backups are retained for a period of time as defined by the backup retention policy, and they cannot be deleted by the customer. \ - * **Customer On-Demand**: A full backup triggered by the customer. These backups are retained for a period of time as defined by the backup retention policy, and they can also be deleted by the customer. - */ -export type BackupType = string; - -/** Known values of {@link HighAvailabilityMode} that the service accepts. */ -export enum KnownHighAvailabilityMode { - /** High availability is enabled for the server, with standby server in a different availability zone than that of the primary. */ - ZoneRedundant = "ZoneRedundant", - /** High availability is enabled for the server, with standby server in the same availability zone as the primary. */ - SameZone = "SameZone", -} - -/** - * Defines values for HighAvailabilityMode. \ - * {@link KnownHighAvailabilityMode} can be used interchangeably with HighAvailabilityMode, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **ZoneRedundant**: High availability is enabled for the server, with standby server in a different availability zone than that of the primary. \ - * **SameZone**: High availability is enabled for the server, with standby server in the same availability zone as the primary. - */ -export type HighAvailabilityMode = string; - -/** Known values of {@link FeatureStatus} that the service accepts. */ -export enum KnownFeatureStatus { - /** Feature is enabled. */ - Enabled = "Enabled", - /** Feature is disabled. */ - Disabled = "Disabled", -} - -/** - * Defines values for FeatureStatus. \ - * {@link KnownFeatureStatus} can be used interchangeably with FeatureStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Feature is enabled. \ - * **Disabled**: Feature is disabled. - */ -export type FeatureStatus = string; - -/** Known values of {@link FastProvisioningSupport} that the service accepts. */ -export enum KnownFastProvisioningSupport { - /** Fast provisioning is supported. */ - Enabled = "Enabled", - /** Fast provisioning is not supported. */ - Disabled = "Disabled", -} - -/** - * Defines values for FastProvisioningSupport. \ - * {@link KnownFastProvisioningSupport} can be used interchangeably with FastProvisioningSupport, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Fast provisioning is supported. \ - * **Disabled**: Fast provisioning is not supported. - */ -export type FastProvisioningSupport = string; - -/** Known values of {@link GeographicallyRedundantBackupSupport} that the service accepts. */ -export enum KnownGeographicallyRedundantBackupSupport { - /** Geographically redundant backups are supported. */ - Enabled = "Enabled", - /** Geographically redundant backups are not supported. */ - Disabled = "Disabled", -} - -/** - * Defines values for GeographicallyRedundantBackupSupport. \ - * {@link KnownGeographicallyRedundantBackupSupport} can be used interchangeably with GeographicallyRedundantBackupSupport, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Geographically redundant backups are supported. \ - * **Disabled**: Geographically redundant backups are not supported. - */ -export type GeographicallyRedundantBackupSupport = string; - -/** Known values of {@link ZoneRedundantHighAvailabilitySupport} that the service accepts. */ -export enum KnownZoneRedundantHighAvailabilitySupport { - /** High availability with zone redundancy is supported. */ - Enabled = "Enabled", - /** High availability with zone redundancy is not supported. */ - Disabled = "Disabled", -} - -/** - * Defines values for ZoneRedundantHighAvailabilitySupport. \ - * {@link KnownZoneRedundantHighAvailabilitySupport} can be used interchangeably with ZoneRedundantHighAvailabilitySupport, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: High availability with zone redundancy is supported. \ - * **Disabled**: High availability with zone redundancy is not supported. - */ -export type ZoneRedundantHighAvailabilitySupport = string; - -/** Known values of {@link ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport} that the service accepts. */ -export enum KnownZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport { - /** High availability with zone redundancy is supported in conjunction with geographically redundant backups. */ - Enabled = "Enabled", - /** High availability with zone redundancy is not supported in conjunction with geographically redundant backups. */ - Disabled = "Disabled", -} - -/** - * Defines values for ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport. \ - * {@link KnownZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport} can be used interchangeably with ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: High availability with zone redundancy is supported in conjunction with geographically redundant backups. \ - * **Disabled**: High availability with zone redundancy is not supported in conjunction with geographically redundant backups. - */ -export type ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport = string; - -/** Known values of {@link StorageAutoGrowthSupport} that the service accepts. */ -export enum KnownStorageAutoGrowthSupport { - /** Storage autogrow is supported. */ - Enabled = "Enabled", - /** Storage autogrow is not supported. */ - Disabled = "Disabled", -} - -/** - * Defines values for StorageAutoGrowthSupport. \ - * {@link KnownStorageAutoGrowthSupport} can be used interchangeably with StorageAutoGrowthSupport, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Storage autogrow is supported. \ - * **Disabled**: Storage autogrow is not supported. - */ -export type StorageAutoGrowthSupport = string; - -/** Known values of {@link OnlineStorageResizeSupport} that the service accepts. */ -export enum KnownOnlineStorageResizeSupport { - /** Resizing the storage without interrupting the operation of the database engine is supported. */ - Enabled = "Enabled", - /** Resizing the storage without interrupting the operation of the database engine is not supported. */ - Disabled = "Disabled", -} - -/** - * Defines values for OnlineStorageResizeSupport. \ - * {@link KnownOnlineStorageResizeSupport} can be used interchangeably with OnlineStorageResizeSupport, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Resizing the storage without interrupting the operation of the database engine is supported. \ - * **Disabled**: Resizing the storage without interrupting the operation of the database engine is not supported. - */ -export type OnlineStorageResizeSupport = string; - -/** Known values of {@link LocationRestricted} that the service accepts. */ -export enum KnownLocationRestricted { - /** Location is restricted. */ - Enabled = "Enabled", - /** Location is not restricted. */ - Disabled = "Disabled", -} - -/** - * Defines values for LocationRestricted. \ - * {@link KnownLocationRestricted} can be used interchangeably with LocationRestricted, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Location is restricted. \ - * **Disabled**: Location is not restricted. - */ -export type LocationRestricted = string; - -/** Known values of {@link ConfigurationDataType} that the service accepts. */ -export enum KnownConfigurationDataType { - /** A boolean value. */ - Boolean = "Boolean", - /** A numeric value. */ - Numeric = "Numeric", - /** An integer value. */ - Integer = "Integer", - /** An enumeration value. */ - Enumeration = "Enumeration", - /** A string value. */ - String = "String", - /** A set of values. */ - Set = "Set", -} - -/** - * Defines values for ConfigurationDataType. \ - * {@link KnownConfigurationDataType} can be used interchangeably with ConfigurationDataType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Boolean**: A boolean value. \ - * **Numeric**: A numeric value. \ - * **Integer**: An integer value. \ - * **Enumeration**: An enumeration value. \ - * **String**: A string value. \ - * **Set**: A set of values. - */ -export type ConfigurationDataType = string; - -/** Known values of {@link ExecutionStatus} that the service accepts. */ -export enum KnownExecutionStatus { - /** The operation is currently running. */ - Running = "Running", - /** The operation was cancelled. */ - Cancelled = "Cancelled", - /** The operation failed. */ - Failed = "Failed", - /** The operation succeeded. */ - Succeeded = "Succeeded", -} - -/** - * Defines values for ExecutionStatus. \ - * {@link KnownExecutionStatus} can be used interchangeably with ExecutionStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Running**: The operation is currently running. \ - * **Cancelled**: The operation was cancelled. \ - * **Failed**: The operation failed. \ - * **Succeeded**: The operation succeeded. - */ -export type ExecutionStatus = string; - -/** Known values of {@link MigrationState} that the service accepts. */ -export enum KnownMigrationState { - /** Migration is in progress. */ - InProgress = "InProgress", - /** Migration is waiting for user action. */ - WaitingForUserAction = "WaitingForUserAction", - /** Migration has been canceled. */ - Canceled = "Canceled", - /** Migration has failed. */ - Failed = "Failed", - /** Migration has succeeded. */ - Succeeded = "Succeeded", - /** Validation for migration has failed. */ - ValidationFailed = "ValidationFailed", - /** Migration is cleaning up resources. */ - CleaningUp = "CleaningUp", -} - -/** - * Defines values for MigrationState. \ - * {@link KnownMigrationState} can be used interchangeably with MigrationState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **InProgress**: Migration is in progress. \ - * **WaitingForUserAction**: Migration is waiting for user action. \ - * **Canceled**: Migration has been canceled. \ - * **Failed**: Migration has failed. \ - * **Succeeded**: Migration has succeeded. \ - * **ValidationFailed**: Validation for migration has failed. \ - * **CleaningUp**: Migration is cleaning up resources. - */ -export type MigrationState = string; - -/** Known values of {@link MigrationSubstate} that the service accepts. */ -export enum KnownMigrationSubstate { - /** Performing pre-requisite steps for migration. */ - PerformingPreRequisiteSteps = "PerformingPreRequisiteSteps", - /** Waiting for logical replication setup request on source database. */ - WaitingForLogicalReplicationSetupRequestOnSourceDB = "WaitingForLogicalReplicationSetupRequestOnSourceDB", - /** Waiting for databases to migrate specification. */ - WaitingForDBsToMigrateSpecification = "WaitingForDBsToMigrateSpecification", - /** Waiting for target database overwrite confirmation. */ - WaitingForTargetDBOverwriteConfirmation = "WaitingForTargetDBOverwriteConfirmation", - /** Waiting for data migration scheduling. */ - WaitingForDataMigrationScheduling = "WaitingForDataMigrationScheduling", - /** Waiting for data migration window. */ - WaitingForDataMigrationWindow = "WaitingForDataMigrationWindow", - /** Migrating data. */ - MigratingData = "MigratingData", - /** Waiting for cutover trigger. */ - WaitingForCutoverTrigger = "WaitingForCutoverTrigger", - /** Completing migration. */ - CompletingMigration = "CompletingMigration", - /** Migration completed. */ - Completed = "Completed", - /** Canceling requested database migrations. */ - CancelingRequestedDBMigrations = "CancelingRequestedDBMigrations", - /** Validation in progress. */ - ValidationInProgress = "ValidationInProgress", -} - -/** - * Defines values for MigrationSubstate. \ - * {@link KnownMigrationSubstate} can be used interchangeably with MigrationSubstate, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **PerformingPreRequisiteSteps**: Performing pre-requisite steps for migration. \ - * **WaitingForLogicalReplicationSetupRequestOnSourceDB**: Waiting for logical replication setup request on source database. \ - * **WaitingForDBsToMigrateSpecification**: Waiting for databases to migrate specification. \ - * **WaitingForTargetDBOverwriteConfirmation**: Waiting for target database overwrite confirmation. \ - * **WaitingForDataMigrationScheduling**: Waiting for data migration scheduling. \ - * **WaitingForDataMigrationWindow**: Waiting for data migration window. \ - * **MigratingData**: Migrating data. \ - * **WaitingForCutoverTrigger**: Waiting for cutover trigger. \ - * **CompletingMigration**: Completing migration. \ - * **Completed**: Migration completed. \ - * **CancelingRequestedDBMigrations**: Canceling requested database migrations. \ - * **ValidationInProgress**: Validation in progress. - */ -export type MigrationSubstate = string; - -/** Known values of {@link MigrationDatabaseState} that the service accepts. */ -export enum KnownMigrationDatabaseState { - /** Migration is in progress for the database. */ - InProgress = "InProgress", - /** Migration is waiting for cutover trigger for the database. */ - WaitingForCutoverTrigger = "WaitingForCutoverTrigger", - /** Migration has failed for the database. */ - Failed = "Failed", - /** Migration has been canceled for the database. */ - Canceled = "Canceled", - /** Migration has succeeded for the database. */ - Succeeded = "Succeeded", - /** Migration is canceling for the database. */ - Canceling = "Canceling", -} - -/** - * Defines values for MigrationDatabaseState. \ - * {@link KnownMigrationDatabaseState} can be used interchangeably with MigrationDatabaseState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **InProgress**: Migration is in progress for the database. \ - * **WaitingForCutoverTrigger**: Migration is waiting for cutover trigger for the database. \ - * **Failed**: Migration has failed for the database. \ - * **Canceled**: Migration has been canceled for the database. \ - * **Succeeded**: Migration has succeeded for the database. \ - * **Canceling**: Migration is canceling for the database. - */ -export type MigrationDatabaseState = string; - -/** Known values of {@link ValidationState} that the service accepts. */ -export enum KnownValidationState { - /** Validation has failed. */ - Failed = "Failed", - /** Validation has succeeded. */ - Succeeded = "Succeeded", - /** Validation has succeeded with warnings. */ - Warning = "Warning", -} - -/** - * Defines values for ValidationState. \ - * {@link KnownValidationState} can be used interchangeably with ValidationState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Failed**: Validation has failed. \ - * **Succeeded**: Validation has succeeded. \ - * **Warning**: Validation has succeeded with warnings. - */ -export type ValidationState = string; - -/** Known values of {@link MigrationMode} that the service accepts. */ -export enum KnownMigrationMode { - /** Offline migration mode. */ - Offline = "Offline", - /** Online migration mode. */ - Online = "Online", -} - -/** - * Defines values for MigrationMode. \ - * {@link KnownMigrationMode} can be used interchangeably with MigrationMode, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Offline**: Offline migration mode. \ - * **Online**: Online migration mode. - */ -export type MigrationMode = string; - -/** Known values of {@link MigrationOption} that the service accepts. */ -export enum KnownMigrationOption { - /** Validate the migration without performing it. */ - Validate = "Validate", - /** Perform the migration. */ - Migrate = "Migrate", - /** Validate and perform the migration. */ - ValidateAndMigrate = "ValidateAndMigrate", -} - -/** - * Defines values for MigrationOption. \ - * {@link KnownMigrationOption} can be used interchangeably with MigrationOption, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Validate**: Validate the migration without performing it. \ - * **Migrate**: Perform the migration. \ - * **ValidateAndMigrate**: Validate and perform the migration. - */ -export type MigrationOption = string; - -/** Known values of {@link SourceType} that the service accepts. */ -export enum KnownSourceType { - /** On-premises PostgreSQL server. */ - OnPremises = "OnPremises", - /** Amazon Web Services PostgreSQL server. */ - AWS = "AWS", - /** Google Cloud Platform PostgreSQL server. */ - GCP = "GCP", - /** Azure Virtual Machine PostgreSQL server. */ - AzureVM = "AzureVM", - /** Azure Database for PostgreSQL single server. */ - PostgreSQLSingleServer = "PostgreSQLSingleServer", - /** Amazon RDS for PostgreSQL. */ - AWSRDS = "AWS_RDS", - /** Amazon Aurora for PostgreSQL. */ - AWSAurora = "AWS_AURORA", - /** Amazon EC2 for PostgreSQL. */ - AWSEC2 = "AWS_EC2", - /** Google Cloud SQL for PostgreSQL. */ - GCPCloudSQL = "GCP_CloudSQL", - /** Google Cloud AlloyDB for PostgreSQL. */ - GCPAlloyDB = "GCP_AlloyDB", - /** Google Compute Engine for PostgreSQL. */ - GCPCompute = "GCP_Compute", - /** EnterpriseDB PostgreSQL server. */ - EDB = "EDB", - /** EnterpriseDB Oracle Server. */ - EDBOracleServer = "EDB_Oracle_Server", - /** EnterpriseDB PostgreSQL server. */ - EDBPostgreSQL = "EDB_PostgreSQL", - /** Azure Database for PostgreSQL flexible server. */ - PostgreSQLFlexibleServer = "PostgreSQLFlexibleServer", - /** .NET Cosmos DB for PostgreSQL */ - PostgreSQLCosmosDB = "PostgreSQLCosmosDB", - /** Huawei RDS for PostgreSQL */ - HuaweiRDS = "Huawei_RDS", - /** Huawei Compute for PostgreSQL */ - HuaweiCompute = "Huawei_Compute", - /** Heroku PostgreSQL */ - HerokuPostgreSQL = "Heroku_PostgreSQL", - /** Crunchy PostgreSQL */ - CrunchyPostgreSQL = "Crunchy_PostgreSQL", - /** ApsaraDB RDS for PostgreSQL */ - ApsaraDBRDS = "ApsaraDB_RDS", - /** Digital Ocean Droplets for PostgreSQL */ - DigitalOceanDroplets = "Digital_Ocean_Droplets", - /** Digital Ocean PostgreSQL */ - DigitalOceanPostgreSQL = "Digital_Ocean_PostgreSQL", - /** Supabase PostgreSQL */ - SupabasePostgreSQL = "Supabase_PostgreSQL", -} - -/** - * Defines values for SourceType. \ - * {@link KnownSourceType} can be used interchangeably with SourceType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **OnPremises**: On-premises PostgreSQL server. \ - * **AWS**: Amazon Web Services PostgreSQL server. \ - * **GCP**: Google Cloud Platform PostgreSQL server. \ - * **AzureVM**: Azure Virtual Machine PostgreSQL server. \ - * **PostgreSQLSingleServer**: Azure Database for PostgreSQL single server. \ - * **AWS_RDS**: Amazon RDS for PostgreSQL. \ - * **AWS_AURORA**: Amazon Aurora for PostgreSQL. \ - * **AWS_EC2**: Amazon EC2 for PostgreSQL. \ - * **GCP_CloudSQL**: Google Cloud SQL for PostgreSQL. \ - * **GCP_AlloyDB**: Google Cloud AlloyDB for PostgreSQL. \ - * **GCP_Compute**: Google Compute Engine for PostgreSQL. \ - * **EDB**: EnterpriseDB PostgreSQL server. \ - * **EDB_Oracle_Server**: EnterpriseDB Oracle Server. \ - * **EDB_PostgreSQL**: EnterpriseDB PostgreSQL server. \ - * **PostgreSQLFlexibleServer**: Azure Database for PostgreSQL flexible server. \ - * **PostgreSQLCosmosDB**: .NET Cosmos DB for PostgreSQL \ - * **Huawei_RDS**: Huawei RDS for PostgreSQL \ - * **Huawei_Compute**: Huawei Compute for PostgreSQL \ - * **Heroku_PostgreSQL**: Heroku PostgreSQL \ - * **Crunchy_PostgreSQL**: Crunchy PostgreSQL \ - * **ApsaraDB_RDS**: ApsaraDB RDS for PostgreSQL \ - * **Digital_Ocean_Droplets**: Digital Ocean Droplets for PostgreSQL \ - * **Digital_Ocean_PostgreSQL**: Digital Ocean PostgreSQL \ - * **Supabase_PostgreSQL**: Supabase PostgreSQL - */ -export type SourceType = string; - -/** Known values of {@link SslMode} that the service accepts. */ -export enum KnownSslMode { - /** Prefer SSL connection. If the server does not support SSL, the connection will be established without SSL. */ - Prefer = "Prefer", - /** Require SSL connection. If the server does not support SSL, the connection will fail. */ - Require = "Require", - /** Require SSL connection and verify the server certificate against the CA certificate. */ - VerifyCA = "VerifyCA", - /** Require SSL connection, verify the server certificate against the CA certificate, and verify that the server hostname matches the certificate. */ - VerifyFull = "VerifyFull", -} - -/** - * Defines values for SslMode. \ - * {@link KnownSslMode} can be used interchangeably with SslMode, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Prefer**: Prefer SSL connection. If the server does not support SSL, the connection will be established without SSL. \ - * **Require**: Require SSL connection. If the server does not support SSL, the connection will fail. \ - * **VerifyCA**: Require SSL connection and verify the server certificate against the CA certificate. \ - * **VerifyFull**: Require SSL connection, verify the server certificate against the CA certificate, and verify that the server hostname matches the certificate. - */ -export type SslMode = string; - -/** Known values of {@link SkuTier} that the service accepts. */ -export enum KnownSkuTier { - /** Burstable */ - Burstable = "Burstable", - /** GeneralPurpose */ - GeneralPurpose = "GeneralPurpose", - /** MemoryOptimized */ - MemoryOptimized = "MemoryOptimized", -} - -/** - * Defines values for SkuTier. \ - * {@link KnownSkuTier} can be used interchangeably with SkuTier, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Burstable** \ - * **GeneralPurpose** \ - * **MemoryOptimized** - */ -export type SkuTier = string; - -/** Known values of {@link LogicalReplicationOnSourceServer} that the service accepts. */ -export enum KnownLogicalReplicationOnSourceServer { - /** Logical replication will be set up on the source server. */ - True = "True", - /** Logical replication will not be set up on the source server. */ - False = "False", -} - -/** - * Defines values for LogicalReplicationOnSourceServer. \ - * {@link KnownLogicalReplicationOnSourceServer} can be used interchangeably with LogicalReplicationOnSourceServer, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **True**: Logical replication will be set up on the source server. \ - * **False**: Logical replication will not be set up on the source server. - */ -export type LogicalReplicationOnSourceServer = string; - -/** Known values of {@link OverwriteDatabasesOnTargetServer} that the service accepts. */ -export enum KnownOverwriteDatabasesOnTargetServer { - /** Databases on the target server can be overwritten when already present. */ - True = "True", - /** Databases on the target server cannot be overwritten when already present. */ - False = "False", -} - -/** - * Defines values for OverwriteDatabasesOnTargetServer. \ - * {@link KnownOverwriteDatabasesOnTargetServer} can be used interchangeably with OverwriteDatabasesOnTargetServer, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **True**: Databases on the target server can be overwritten when already present. \ - * **False**: Databases on the target server cannot be overwritten when already present. - */ -export type OverwriteDatabasesOnTargetServer = string; - -/** Known values of {@link MigrateRolesAndPermissions} that the service accepts. */ -export enum KnownMigrateRolesAndPermissions { - /** Roles and permissions will be migrated. */ - True = "True", - /** Roles and permissions will not be migrated. */ - False = "False", -} - -/** - * Defines values for MigrateRolesAndPermissions. \ - * {@link KnownMigrateRolesAndPermissions} can be used interchangeably with MigrateRolesAndPermissions, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **True**: Roles and permissions will be migrated. \ - * **False**: Roles and permissions will not be migrated. - */ -export type MigrateRolesAndPermissions = string; - -/** Known values of {@link StartDataMigration} that the service accepts. */ -export enum KnownStartDataMigration { - /** Data migration must start right away. */ - True = "True", - /** Data migration must not start right away. */ - False = "False", -} - -/** - * Defines values for StartDataMigration. \ - * {@link KnownStartDataMigration} can be used interchangeably with StartDataMigration, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **True**: Data migration must start right away. \ - * **False**: Data migration must not start right away. - */ -export type StartDataMigration = string; - -/** Known values of {@link TriggerCutover} that the service accepts. */ -export enum KnownTriggerCutover { - /** Cutover must be triggered for the entire migration. */ - True = "True", - /** Cutover must not be triggered for the entire migration. */ - False = "False", -} - -/** - * Defines values for TriggerCutover. \ - * {@link KnownTriggerCutover} can be used interchangeably with TriggerCutover, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **True**: Cutover must be triggered for the entire migration. \ - * **False**: Cutover must not be triggered for the entire migration. - */ -export type TriggerCutover = string; - -/** Known values of {@link Cancel} that the service accepts. */ -export enum KnownCancel { - /** Cancel must be triggered for the entire migration. */ - True = "True", - /** Cancel must not be triggered for the entire migration. */ - False = "False", -} - -/** - * Defines values for Cancel. \ - * {@link KnownCancel} can be used interchangeably with Cancel, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **True**: Cancel must be triggered for the entire migration. \ - * **False**: Cancel must not be triggered for the entire migration. - */ -export type Cancel = string; - -/** Known values of {@link MigrationListFilter} that the service accepts. */ -export enum KnownMigrationListFilter { - /** Only active (in-progress) migrations. */ - Active = "Active", - /** All migrations. */ - All = "All", -} - -/** - * Defines values for MigrationListFilter. \ - * {@link KnownMigrationListFilter} can be used interchangeably with MigrationListFilter, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Active**: Only active (in-progress) migrations. \ - * **All**: All migrations. - */ -export type MigrationListFilter = string; - -/** Known values of {@link MigrationNameAvailabilityReason} that the service accepts. */ -export enum KnownMigrationNameAvailabilityReason { - /** Migration name is invalid. */ - Invalid = "Invalid", - /** Migration name already exists. */ - AlreadyExists = "AlreadyExists", -} - -/** - * Defines values for MigrationNameAvailabilityReason. \ - * {@link KnownMigrationNameAvailabilityReason} can be used interchangeably with MigrationNameAvailabilityReason, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Invalid**: Migration name is invalid. \ - * **AlreadyExists**: Migration name already exists. - */ -export type MigrationNameAvailabilityReason = string; - -/** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */ -export enum KnownCheckNameAvailabilityReason { - /** Invalid */ - Invalid = "Invalid", - /** AlreadyExists */ - AlreadyExists = "AlreadyExists", -} - -/** - * Defines values for CheckNameAvailabilityReason. \ - * {@link KnownCheckNameAvailabilityReason} can be used interchangeably with CheckNameAvailabilityReason, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Invalid** \ - * **AlreadyExists** - */ -export type CheckNameAvailabilityReason = string; - -/** Known values of {@link OperationOrigin} that the service accepts. */ -export enum KnownOperationOrigin { - /** The origin is not specified. */ - NotSpecified = "NotSpecified", - /** The operation is initiated by a user. */ - User = "user", - /** The operation is initiated by the system. */ - System = "system", -} - -/** - * Defines values for OperationOrigin. \ - * {@link KnownOperationOrigin} can be used interchangeably with OperationOrigin, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **NotSpecified**: The origin is not specified. \ - * **user**: The operation is initiated by a user. \ - * **system**: The operation is initiated by the system. - */ -export type OperationOrigin = string; - -/** Known values of {@link PrivateEndpointServiceConnectionStatus} that the service accepts. */ -export enum KnownPrivateEndpointServiceConnectionStatus { - /** Pending */ - Pending = "Pending", - /** Approved */ - Approved = "Approved", - /** Rejected */ - Rejected = "Rejected", -} - -/** - * Defines values for PrivateEndpointServiceConnectionStatus. \ - * {@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; - -/** Known values of {@link PrivateEndpointConnectionProvisioningState} that the service accepts. */ -export enum KnownPrivateEndpointConnectionProvisioningState { - /** Succeeded */ - Succeeded = "Succeeded", - /** Creating */ - Creating = "Creating", - /** Deleting */ - Deleting = "Deleting", - /** Failed */ - Failed = "Failed", -} - -/** - * Defines values for PrivateEndpointConnectionProvisioningState. \ - * {@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; - -/** Known values of {@link IdentityType} that the service accepts. */ -export enum KnownIdentityType { - /** No managed identity is assigned to the server. */ - None = "None", - /** One or more managed identities provided by the user are assigned to the server. */ - UserAssigned = "UserAssigned", - /** Azure automatically creates and manages the identity associated to the lifecycle of the server. */ - SystemAssigned = "SystemAssigned", - /** Both system-assigned and user-assigned identities are assigned to the server. */ - SystemAssignedUserAssigned = "SystemAssigned,UserAssigned", -} - -/** - * Defines values for IdentityType. \ - * {@link KnownIdentityType} can be used interchangeably with IdentityType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **None**: No managed identity is assigned to the server. \ - * **UserAssigned**: One or more managed identities provided by the user are assigned to the server. \ - * **SystemAssigned**: Azure automatically creates and manages the identity associated to the lifecycle of the server. \ - * **SystemAssigned,UserAssigned**: Both system-assigned and user-assigned identities are assigned to the server. - */ -export type IdentityType = string; - -/** Known values of {@link PostgresMajorVersion} that the service accepts. */ -export enum KnownPostgresMajorVersion { - /** PostgreSQL 18. */ - Eighteen = "18", - /** PostgreSQL 17. */ - Seventeen = "17", - /** PostgreSQL 16. */ - Sixteen = "16", - /** PostgreSQL 15. */ - Fifteen = "15", - /** PostgreSQL 14. */ - Fourteen = "14", - /** PostgreSQL 13. */ - Thirteen = "13", - /** PostgreSQL 12. */ - Twelve = "12", - /** PostgreSQL 11. */ - Eleven = "11", -} - -/** - * Defines values for PostgresMajorVersion. \ - * {@link KnownPostgresMajorVersion} can be used interchangeably with PostgresMajorVersion, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **18**: PostgreSQL 18. \ - * **17**: PostgreSQL 17. \ - * **16**: PostgreSQL 16. \ - * **15**: PostgreSQL 15. \ - * **14**: PostgreSQL 14. \ - * **13**: PostgreSQL 13. \ - * **12**: PostgreSQL 12. \ - * **11**: PostgreSQL 11. - */ -export type PostgresMajorVersion = string; - -/** Known values of {@link ServerState} that the service accepts. */ -export enum KnownServerState { - /** Server is healthy and not undergoing any operations at the management or control plane level. This doesn't mean that the server is fully operational at the data plane level. */ - Ready = "Ready", - /** Server is being deleted. */ - Dropping = "Dropping", - /** Server is disabled. Typical reasons include: the subscription on which the server is deployed is explicitly disabled or canceled by the administrator, the spending limit has been reached, or the bill is past due. May also happen when the server is being moved to another resource group or subscription. */ - Disabled = "Disabled", - /** PostgreSQL database engine is being restarted. */ - Starting = "Starting", - /** Compute resources associated with the server are being stopped and deallocated. If the server has high availability enabled, the compute resources of the standby server are also stopped and deallocated. */ - Stopping = "Stopping", - /** Compute resources associated with the server are being stopped and deallocated. */ - Stopped = "Stopped", - /** Server is undergoing some changes which may or may not impact the availability of the PostgreSQL database engine. For example, the compute resources of the server are being scaled up or down, which may cause temporary unavailability of the database engine. Or, for example, a firewall rule is being added or removed, which doesn't cause any unavailability of the database engine. */ - Updating = "Updating", - /** PostgreSQL database engine is being restarted. */ - Restarting = "Restarting", - /** Server isn't accessible, because the key provided to encrypt and decrypt the data is in invalid state. */ - Inaccessible = "Inaccessible", - /** Server is in the process of being created. */ - Provisioning = "Provisioning", -} - -/** - * Defines values for ServerState. \ - * {@link KnownServerState} can be used interchangeably with ServerState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Ready**: Server is healthy and not undergoing any operations at the management or control plane level. This doesn't mean that the server is fully operational at the data plane level. \ - * **Dropping**: Server is being deleted. \ - * **Disabled**: Server is disabled. Typical reasons include: the subscription on which the server is deployed is explicitly disabled or canceled by the administrator, the spending limit has been reached, or the bill is past due. May also happen when the server is being moved to another resource group or subscription. \ - * **Starting**: PostgreSQL database engine is being restarted. \ - * **Stopping**: Compute resources associated with the server are being stopped and deallocated. If the server has high availability enabled, the compute resources of the standby server are also stopped and deallocated. \ - * **Stopped**: Compute resources associated with the server are being stopped and deallocated. \ - * **Updating**: Server is undergoing some changes which may or may not impact the availability of the PostgreSQL database engine. For example, the compute resources of the server are being scaled up or down, which may cause temporary unavailability of the database engine. Or, for example, a firewall rule is being added or removed, which doesn't cause any unavailability of the database engine. \ - * **Restarting**: PostgreSQL database engine is being restarted. \ - * **Inaccessible**: Server isn't accessible, because the key provided to encrypt and decrypt the data is in invalid state. \ - * **Provisioning**: Server is in the process of being created. - */ -export type ServerState = string; - -/** Known values of {@link StorageAutoGrow} that the service accepts. */ -export enum KnownStorageAutoGrow { - /** Server should automatically grow storage size when available space is nearing zero and conditions allow for automatically growing storage size. */ - Enabled = "Enabled", - /** Server should not automatically grow storage size when available space is nearing zero. */ - Disabled = "Disabled", -} - -/** - * Defines values for StorageAutoGrow. \ - * {@link KnownStorageAutoGrow} can be used interchangeably with StorageAutoGrow, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Server should automatically grow storage size when available space is nearing zero and conditions allow for automatically growing storage size. \ - * **Disabled**: Server should not automatically grow storage size when available space is nearing zero. - */ -export type StorageAutoGrow = string; - -/** Known values of {@link AzureManagedDiskPerformanceTier} that the service accepts. */ -export enum KnownAzureManagedDiskPerformanceTier { - /** Entry-level SSD for minimal IOPS, ideal for light development or testing workloads. */ - P1 = "P1", - /** Slightly higher IOPS for small-scale applications needing consistent low latency. */ - P2 = "P2", - /** Balanced performance for basic production workloads with moderate throughput. */ - P3 = "P3", - /** Enhanced IOPS for growing apps with predictable performance needs. */ - P4 = "P4", - /** Mid-tier SSD for steady workloads requiring reliable throughput and latency. */ - P6 = "P6", - /** Popular choice for general-purpose production workloads with scalable performance. */ - P10 = "P10", - /** High IOPS tier for demanding apps with frequent read\/write operations. */ - P15 = "P15", - /** Entry point for high-performance Solid State Disks (SSDs), suitable for small-scale I\/O-intensive workloads. */ - P20 = "P20", - /** Balanced tier for moderate throughput and latency-sensitive applications. */ - P30 = "P30", - /** Enhanced performance for growing production workloads with consistent IOPS demands. */ - P40 = "P40", - /** Optimized for enterprise-grade applications needing sustained high throughput. */ - P50 = "P50", - /** High-capacity tier for large databases and analytics workloads with elevated IOPS. */ - P60 = "P60", - /** Designed for mission-critical systems requiring ultra-low latency and high concurrency. */ - P70 = "P70", - /** Top-tier SSD for maximum IOPS and throughput, ideal for the most demanding workloads. */ - P80 = "P80", -} - -/** - * Defines values for AzureManagedDiskPerformanceTier. \ - * {@link KnownAzureManagedDiskPerformanceTier} can be used interchangeably with AzureManagedDiskPerformanceTier, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **P1**: Entry-level SSD for minimal IOPS, ideal for light development or testing workloads. \ - * **P2**: Slightly higher IOPS for small-scale applications needing consistent low latency. \ - * **P3**: Balanced performance for basic production workloads with moderate throughput. \ - * **P4**: Enhanced IOPS for growing apps with predictable performance needs. \ - * **P6**: Mid-tier SSD for steady workloads requiring reliable throughput and latency. \ - * **P10**: Popular choice for general-purpose production workloads with scalable performance. \ - * **P15**: High IOPS tier for demanding apps with frequent read\/write operations. \ - * **P20**: Entry point for high-performance Solid State Disks (SSDs), suitable for small-scale I\/O-intensive workloads. \ - * **P30**: Balanced tier for moderate throughput and latency-sensitive applications. \ - * **P40**: Enhanced performance for growing production workloads with consistent IOPS demands. \ - * **P50**: Optimized for enterprise-grade applications needing sustained high throughput. \ - * **P60**: High-capacity tier for large databases and analytics workloads with elevated IOPS. \ - * **P70**: Designed for mission-critical systems requiring ultra-low latency and high concurrency. \ - * **P80**: Top-tier SSD for maximum IOPS and throughput, ideal for the most demanding workloads. - */ -export type AzureManagedDiskPerformanceTier = string; - -/** Known values of {@link StorageType} that the service accepts. */ -export enum KnownStorageType { - /** Standard Solid State Disk (SSD) backed storage offering consistent performance for general purpose workloads. */ - PremiumLRS = "Premium_LRS", - /** Next generation Solid State Disk (SSD) storage with improved scalability and performance for demanding enterprise workloads. */ - PremiumV2LRS = "PremiumV2_LRS", - /** High-end Solid State Disk (SSD) storage designed for extreme IOPS and latency-sensitive applications. */ - UltraSSDLRS = "UltraSSD_LRS", -} - -/** - * Defines values for StorageType. \ - * {@link KnownStorageType} can be used interchangeably with StorageType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Premium_LRS**: Standard Solid State Disk (SSD) backed storage offering consistent performance for general purpose workloads. \ - * **PremiumV2_LRS**: Next generation Solid State Disk (SSD) storage with improved scalability and performance for demanding enterprise workloads. \ - * **UltraSSD_LRS**: High-end Solid State Disk (SSD) storage designed for extreme IOPS and latency-sensitive applications. - */ -export type StorageType = string; - -/** Known values of {@link MicrosoftEntraAuth} that the service accepts. */ -export enum KnownMicrosoftEntraAuth { - /** Server supports Microsoft Entra authentication. */ - Enabled = "Enabled", - /** Server doesn't support Microsoft Entra authentication. */ - Disabled = "Disabled", -} - -/** - * Defines values for MicrosoftEntraAuth. \ - * {@link KnownMicrosoftEntraAuth} can be used interchangeably with MicrosoftEntraAuth, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Server supports Microsoft Entra authentication. \ - * **Disabled**: Server doesn't support Microsoft Entra authentication. - */ -export type MicrosoftEntraAuth = string; - -/** Known values of {@link PasswordBasedAuth} that the service accepts. */ -export enum KnownPasswordBasedAuth { - /** Server supports password based authentication. */ - Enabled = "Enabled", - /** Server doesn't support password based authentication. */ - Disabled = "Disabled", -} - -/** - * Defines values for PasswordBasedAuth. \ - * {@link KnownPasswordBasedAuth} can be used interchangeably with PasswordBasedAuth, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Server supports password based authentication. \ - * **Disabled**: Server doesn't support password based authentication. - */ -export type PasswordBasedAuth = string; - -/** Known values of {@link DataEncryptionType} that the service accepts. */ -export enum KnownDataEncryptionType { - /** Encryption managed by Azure using platform managed keys for simplicity and compliance. */ - SystemManaged = "SystemManaged", - /** Encryption using customer managed keys stored in Azure Key Vault for enhanced control and security. */ - AzureKeyVault = "AzureKeyVault", -} - -/** - * Defines values for DataEncryptionType. \ - * {@link KnownDataEncryptionType} can be used interchangeably with DataEncryptionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **SystemManaged**: Encryption managed by Azure using platform managed keys for simplicity and compliance. \ - * **AzureKeyVault**: Encryption using customer managed keys stored in Azure Key Vault for enhanced control and security. - */ -export type DataEncryptionType = string; - -/** Known values of {@link EncryptionKeyStatus} that the service accepts. */ -export enum KnownEncryptionKeyStatus { - /** Key is valid and can be used for encryption. */ - Valid = "Valid", - /** Key is invalid and cannot be used for encryption. Possible causes include key deletion, permission changes, key being disabled, key type not supported, or current date being outside of validity period associated to the key. */ - Invalid = "Invalid", -} - -/** - * Defines values for EncryptionKeyStatus. \ - * {@link KnownEncryptionKeyStatus} can be used interchangeably with EncryptionKeyStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Valid**: Key is valid and can be used for encryption. \ - * **Invalid**: Key is invalid and cannot be used for encryption. Possible causes include key deletion, permission changes, key being disabled, key type not supported, or current date being outside of validity period associated to the key. - */ -export type EncryptionKeyStatus = string; - -/** Known values of {@link GeographicallyRedundantBackup} that the service accepts. */ -export enum KnownGeographicallyRedundantBackup { - /** Server is configured to create geographically redundant backups. */ - Enabled = "Enabled", - /** Server is not configured to create geographically redundant backups. */ - Disabled = "Disabled", -} - -/** - * Defines values for GeographicallyRedundantBackup. \ - * {@link KnownGeographicallyRedundantBackup} can be used interchangeably with GeographicallyRedundantBackup, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Server is configured to create geographically redundant backups. \ - * **Disabled**: Server is not configured to create geographically redundant backups. - */ -export type GeographicallyRedundantBackup = string; - -/** Known values of {@link ServerPublicNetworkAccessState} that the service accepts. */ -export enum KnownServerPublicNetworkAccessState { - /** Public network access is enabled. This allows the server to be accessed from the public internet, provided the necessary firewall rule that allows incoming traffic originating from the connecting client is in place. This is compatible with the use of private endpoints to connect to this server. */ - Enabled = "Enabled", - /** Public network access is disabled. This means the server cannot be accessed from the public internet, but only via private endpoints. */ - Disabled = "Disabled", -} - -/** - * Defines values for ServerPublicNetworkAccessState. \ - * {@link KnownServerPublicNetworkAccessState} can be used interchangeably with ServerPublicNetworkAccessState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Public network access is enabled. This allows the server to be accessed from the public internet, provided the necessary firewall rule that allows incoming traffic originating from the connecting client is in place. This is compatible with the use of private endpoints to connect to this server. \ - * **Disabled**: Public network access is disabled. This means the server cannot be accessed from the public internet, but only via private endpoints. - */ -export type ServerPublicNetworkAccessState = string; - -/** Known values of {@link HighAvailabilityState} that the service accepts. */ -export enum KnownHighAvailabilityState { - /** High availability is not enabled for the server. */ - NotEnabled = "NotEnabled", - /** Standby server is being created. */ - CreatingStandby = "CreatingStandby", - /** Data is being replicated to the standby server. */ - ReplicatingData = "ReplicatingData", - /** Failover operation to the standby server is in progress. */ - FailingOver = "FailingOver", - /** Standby server is healthy and ready to take over in case of a failover. */ - Healthy = "Healthy", - /** Standby server is being removed. */ - RemovingStandby = "RemovingStandby", -} - -/** - * Defines values for HighAvailabilityState. \ - * {@link KnownHighAvailabilityState} can be used interchangeably with HighAvailabilityState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **NotEnabled**: High availability is not enabled for the server. \ - * **CreatingStandby**: Standby server is being created. \ - * **ReplicatingData**: Data is being replicated to the standby server. \ - * **FailingOver**: Failover operation to the standby server is in progress. \ - * **Healthy**: Standby server is healthy and ready to take over in case of a failover. \ - * **RemovingStandby**: Standby server is being removed. - */ -export type HighAvailabilityState = string; - -/** Known values of {@link ReplicationRole} that the service accepts. */ -export enum KnownReplicationRole { - /** No replication role assigned; the server operates independently. */ - None = "None", - /** Acts as the source server for replication to one or more replicas. */ - Primary = "Primary", - /** Receives data asynchronously from a primary server within the same region. */ - AsyncReplica = "AsyncReplica", - /** Receives data asynchronously from a primary server in a different region for geographical redundancy. */ - GeoAsyncReplica = "GeoAsyncReplica", -} - -/** - * Defines values for ReplicationRole. \ - * {@link KnownReplicationRole} can be used interchangeably with ReplicationRole, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **None**: No replication role assigned; the server operates independently. \ - * **Primary**: Acts as the source server for replication to one or more replicas. \ - * **AsyncReplica**: Receives data asynchronously from a primary server within the same region. \ - * **GeoAsyncReplica**: Receives data asynchronously from a primary server in a different region for geographical redundancy. - */ -export type ReplicationRole = string; - -/** Known values of {@link ReplicationState} that the service accepts. */ -export enum KnownReplicationState { - /** Read replica is fully synchronized and actively replicating data from the primary server. */ - Active = "Active", - /** Read replica is behind the primary server and is currently catching up with pending changes. */ - Catchup = "Catchup", - /** Read replica is being created and is in process of getting initialized. */ - Provisioning = "Provisioning", - /** Read replica is undergoing some changes it can be changing compute size of promoting it to primary server. */ - Updating = "Updating", - /** Replication has failed or been interrupted. */ - Broken = "Broken", - /** Read replica is being reconfigured, possibly due to changes in source or settings. */ - Reconfiguring = "Reconfiguring", -} - -/** - * Defines values for ReplicationState. \ - * {@link KnownReplicationState} can be used interchangeably with ReplicationState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Active**: Read replica is fully synchronized and actively replicating data from the primary server. \ - * **Catchup**: Read replica is behind the primary server and is currently catching up with pending changes. \ - * **Provisioning**: Read replica is being created and is in process of getting initialized. \ - * **Updating**: Read replica is undergoing some changes it can be changing compute size of promoting it to primary server. \ - * **Broken**: Replication has failed or been interrupted. \ - * **Reconfiguring**: Read replica is being reconfigured, possibly due to changes in source or settings. - */ -export type ReplicationState = string; - -/** Known values of {@link ReadReplicaPromoteMode} that the service accepts. */ -export enum KnownReadReplicaPromoteMode { - /** Read replica will become an independent server. */ - Standalone = "Standalone", - /** Read replica will swap roles with primary server. */ - Switchover = "Switchover", -} - -/** - * Defines values for ReadReplicaPromoteMode. \ - * {@link KnownReadReplicaPromoteMode} can be used interchangeably with ReadReplicaPromoteMode, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Standalone**: Read replica will become an independent server. \ - * **Switchover**: Read replica will swap roles with primary server. - */ -export type ReadReplicaPromoteMode = string; - -/** Known values of {@link ReadReplicaPromoteOption} that the service accepts. */ -export enum KnownReadReplicaPromoteOption { - /** The operation will wait for data in the read replica to be fully synchronized with its source server, before it initiates the operation. */ - Planned = "Planned", - /** The operation will not wait for data in the read replica to be synchronized with its source server, before it initiates the operation. */ - Forced = "Forced", -} - -/** - * Defines values for ReadReplicaPromoteOption. \ - * {@link KnownReadReplicaPromoteOption} can be used interchangeably with ReadReplicaPromoteOption, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Planned**: The operation will wait for data in the read replica to be fully synchronized with its source server, before it initiates the operation. \ - * **Forced**: The operation will not wait for data in the read replica to be synchronized with its source server, before it initiates the operation. - */ -export type ReadReplicaPromoteOption = string; - -/** Known values of {@link CreateMode} that the service accepts. */ -export enum KnownCreateMode { - /** If the operation is triggered on a non-existing server, it's equivalent to 'Create'. If the operation is triggered on an existing server, it's equivalent to 'Update'. */ - Default = "Default", - /** Operation creates a new server. */ - Create = "Create", - /** Operation updates an existing server. */ - Update = "Update", - /** Operation restores an existing backup of an existing server. This operation creates a new server, and then restores on it the backup of an existing server at a specific point in time. */ - PointInTimeRestore = "PointInTimeRestore", - /** Operation restores an existing backup of an existing server, on the paired region of the existing server. This operation creates a new server on the paired region of the existing server, and then restores on it the backup of an existing server at a specific point in time, in a different region. This operation is only supported on existing servers that were created with geographically redundant backups enabled. */ - GeoRestore = "GeoRestore", - /** Operation creates a replica of an existing server. This operation creates a new server, restores a base backup of the existing server (referred to as primary), and configures physical replication to asynchronously stream all changes which are recorded in the transaction log of the primary. */ - Replica = "Replica", - /** Operation creates a new server, initialized with the backup of a server that was recently deleted. */ - ReviveDropped = "ReviveDropped", -} - -/** - * Defines values for CreateMode. \ - * {@link KnownCreateMode} can be used interchangeably with CreateMode, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Default**: If the operation is triggered on a non-existing server, it's equivalent to 'Create'. If the operation is triggered on an existing server, it's equivalent to 'Update'. \ - * **Create**: Operation creates a new server. \ - * **Update**: Operation updates an existing server. \ - * **PointInTimeRestore**: Operation restores an existing backup of an existing server. This operation creates a new server, and then restores on it the backup of an existing server at a specific point in time. \ - * **GeoRestore**: Operation restores an existing backup of an existing server, on the paired region of the existing server. This operation creates a new server on the paired region of the existing server, and then restores on it the backup of an existing server at a specific point in time, in a different region. This operation is only supported on existing servers that were created with geographically redundant backups enabled. \ - * **Replica**: Operation creates a replica of an existing server. This operation creates a new server, restores a base backup of the existing server (referred to as primary), and configures physical replication to asynchronously stream all changes which are recorded in the transaction log of the primary. \ - * **ReviveDropped**: Operation creates a new server, initialized with the backup of a server that was recently deleted. - */ -export type CreateMode = string; - -/** Known values of {@link CreateModeForPatch} that the service accepts. */ -export enum KnownCreateModeForPatch { - /** It's equivalent to 'Update'. */ - Default = "Default", - /** Operation updates an existing server. */ - Update = "Update", -} - -/** - * Defines values for CreateModeForPatch. \ - * {@link KnownCreateModeForPatch} can be used interchangeably with CreateModeForPatch, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Default**: It's equivalent to 'Update'. \ - * **Update**: Operation updates an existing server. - */ -export type CreateModeForPatch = string; - -/** Known values of {@link FailoverMode} that the service accepts. */ -export enum KnownFailoverMode { - /** Triggers a failover from primary to standby without killing the primary database process first. This is a graceful failover that attempts to preserve data consistency. */ - PlannedFailover = "PlannedFailover", - /** Kills the primary database process first, then triggers the failover. This is more aggressive and used when the primary is unresponsive or in an unhealthy state. */ - ForcedFailover = "ForcedFailover", - /** Similar to 'PlannedFailover' but prefers a switch over operation where roles are swapped between primary and standby. */ - PlannedSwitchover = "PlannedSwitchover", - /** Kills the primary database process and then triggers a switch over with role swapping. */ - ForcedSwitchover = "ForcedSwitchover", -} - -/** - * Defines values for FailoverMode. \ - * {@link KnownFailoverMode} can be used interchangeably with FailoverMode, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **PlannedFailover**: Triggers a failover from primary to standby without killing the primary database process first. This is a graceful failover that attempts to preserve data consistency. \ - * **ForcedFailover**: Kills the primary database process first, then triggers the failover. This is more aggressive and used when the primary is unresponsive or in an unhealthy state. \ - * **PlannedSwitchover**: Similar to 'PlannedFailover' but prefers a switch over operation where roles are swapped between primary and standby. \ - * **ForcedSwitchover**: Kills the primary database process and then triggers a switch over with role swapping. - */ -export type FailoverMode = string; - -/** Known values of {@link TuningOptionParameterEnum} that the service accepts. */ -export enum KnownTuningOptionParameterEnum { - /** Index */ - Index = "index", - /** Table */ - Table = "table", -} - -/** - * Defines values for TuningOptionParameterEnum. \ - * {@link KnownTuningOptionParameterEnum} can be used interchangeably with TuningOptionParameterEnum, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **index** \ - * **table** - */ -export type TuningOptionParameterEnum = string; - -/** Known values of {@link RecommendationTypeParameterEnum} that the service accepts. */ -export enum KnownRecommendationTypeParameterEnum { - /** CreateIndex */ - CreateIndex = "CreateIndex", - /** DropIndex */ - DropIndex = "DropIndex", - /** ReIndex */ - ReIndex = "ReIndex", - /** AnalyzeTable */ - AnalyzeTable = "AnalyzeTable", -} - -/** - * Defines values for RecommendationTypeParameterEnum. \ - * {@link KnownRecommendationTypeParameterEnum} can be used interchangeably with RecommendationTypeParameterEnum, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **CreateIndex** \ - * **DropIndex** \ - * **ReIndex** \ - * **AnalyzeTable** - */ -export type RecommendationTypeParameterEnum = string; - -/** Known values of {@link RecommendationTypeEnum} that the service accepts. */ -export enum KnownRecommendationTypeEnum { - /** CreateIndex */ - CreateIndex = "CreateIndex", - /** DropIndex */ - DropIndex = "DropIndex", - /** ReIndex */ - ReIndex = "ReIndex", - /** AnalyzeTable */ - AnalyzeTable = "AnalyzeTable", -} - -/** - * Defines values for RecommendationTypeEnum. \ - * {@link KnownRecommendationTypeEnum} can be used interchangeably with RecommendationTypeEnum, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **CreateIndex** \ - * **DropIndex** \ - * **ReIndex** \ - * **AnalyzeTable** - */ -export type RecommendationTypeEnum = string; - -/** Known values of {@link VirtualEndpointType} that the service accepts. */ -export enum KnownVirtualEndpointType { - /** Read-write endpoint. */ - ReadWrite = "ReadWrite", -} - -/** - * Defines values for VirtualEndpointType. \ - * {@link KnownVirtualEndpointType} can be used interchangeably with VirtualEndpointType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **ReadWrite**: Read-write endpoint. - */ -export type VirtualEndpointType = string; - -/** Known values of {@link MigrationDetailsLevel} that the service accepts. */ -export enum KnownMigrationDetailsLevel { - /** Default level of details. */ - Default = "Default", - /** Summary level of details. */ - Summary = "Summary", - /** Full level of details. */ - Full = "Full", -} - -/** - * Defines values for MigrationDetailsLevel. \ - * {@link KnownMigrationDetailsLevel} can be used interchangeably with MigrationDetailsLevel, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Default**: Default level of details. \ - * **Summary**: Summary level of details. \ - * **Full**: Full level of details. - */ -export type MigrationDetailsLevel = string; -/** Defines values for ThreatProtectionState. */ -export type ThreatProtectionState = "Enabled" | "Disabled"; -/** Defines values for CapabilityStatus. */ -export type CapabilityStatus = "Visible" | "Available" | "Default" | "Disabled"; - -/** Optional parameters. */ -export interface AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type AdministratorsMicrosoftEntraCreateOrUpdateResponse = AdministratorMicrosoftEntra; - -/** Optional parameters. */ -export interface AdministratorsMicrosoftEntraDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type AdministratorsMicrosoftEntraDeleteResponse = AdministratorsMicrosoftEntraDeleteHeaders; - -/** Optional parameters. */ -export interface AdministratorsMicrosoftEntraGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type AdministratorsMicrosoftEntraGetResponse = AdministratorMicrosoftEntra; - -/** Optional parameters. */ -export interface AdministratorsMicrosoftEntraListByServerOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type AdministratorsMicrosoftEntraListByServerResponse = AdministratorMicrosoftEntraList; - -/** Optional parameters. */ -export interface AdministratorsMicrosoftEntraListByServerNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type AdministratorsMicrosoftEntraListByServerNextResponse = AdministratorMicrosoftEntraList; - -/** Optional parameters. */ -export interface AdvancedThreatProtectionSettingsListByServerOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type AdvancedThreatProtectionSettingsListByServerResponse = - AdvancedThreatProtectionSettingsList; - -/** Optional parameters. */ -export interface AdvancedThreatProtectionSettingsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type AdvancedThreatProtectionSettingsGetResponse = AdvancedThreatProtectionSettingsModel; - -/** Optional parameters. */ -export interface AdvancedThreatProtectionSettingsListByServerNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type AdvancedThreatProtectionSettingsListByServerNextResponse = - AdvancedThreatProtectionSettingsList; - -/** Optional parameters. */ -export interface ServerThreatProtectionSettingsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type ServerThreatProtectionSettingsCreateOrUpdateResponse = - AdvancedThreatProtectionSettingsModel; - -/** Optional parameters. */ -export interface BackupsAutomaticAndOnDemandCreateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the create operation. */ -export type BackupsAutomaticAndOnDemandCreateResponse = BackupAutomaticAndOnDemand; - -/** Optional parameters. */ -export interface BackupsAutomaticAndOnDemandDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type BackupsAutomaticAndOnDemandDeleteResponse = BackupsAutomaticAndOnDemandDeleteHeaders; - -/** Optional parameters. */ -export interface BackupsAutomaticAndOnDemandGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type BackupsAutomaticAndOnDemandGetResponse = BackupAutomaticAndOnDemand; - -/** Optional parameters. */ -export interface BackupsAutomaticAndOnDemandListByServerOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type BackupsAutomaticAndOnDemandListByServerResponse = BackupAutomaticAndOnDemandList; - -/** Optional parameters. */ -export interface BackupsAutomaticAndOnDemandListByServerNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type BackupsAutomaticAndOnDemandListByServerNextResponse = BackupAutomaticAndOnDemandList; - -/** Optional parameters. */ -export interface CapabilitiesByLocationListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type CapabilitiesByLocationListResponse = CapabilityList; - -/** Optional parameters. */ -export interface CapabilitiesByLocationListNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type CapabilitiesByLocationListNextResponse = CapabilityList; - -/** Optional parameters. */ -export interface CapabilitiesByServerListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type CapabilitiesByServerListResponse = CapabilityList; - -/** Optional parameters. */ -export interface CapabilitiesByServerListNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type CapabilitiesByServerListNextResponse = CapabilityList; - -/** Optional parameters. */ -export interface CapturedLogsListByServerOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type CapturedLogsListByServerResponse = CapturedLogList; - -/** Optional parameters. */ -export interface CapturedLogsListByServerNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type CapturedLogsListByServerNextResponse = CapturedLogList; - -/** Optional parameters. */ -export interface ConfigurationsListByServerOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type ConfigurationsListByServerResponse = ConfigurationList; - -/** Optional parameters. */ -export interface ConfigurationsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type ConfigurationsGetResponse = Configuration; - -/** Optional parameters. */ -export interface ConfigurationsUpdateOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type ConfigurationsUpdateResponse = Configuration; - -/** Optional parameters. */ -export interface ConfigurationsPutOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the put operation. */ -export type ConfigurationsPutResponse = Configuration; - -/** Optional parameters. */ -export interface ConfigurationsListByServerNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type ConfigurationsListByServerNextResponse = ConfigurationList; - -/** Optional parameters. */ -export interface DatabasesCreateOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the create operation. */ -export type DatabasesCreateResponse = Database; - -/** Optional parameters. */ -export interface DatabasesDeleteOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type DatabasesDeleteResponse = DatabasesDeleteHeaders; - -/** Optional parameters. */ -export interface DatabasesGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type DatabasesGetResponse = Database; - -/** Optional parameters. */ -export interface DatabasesListByServerOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type DatabasesListByServerResponse = DatabaseList; - -/** Optional parameters. */ -export interface DatabasesListByServerNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type DatabasesListByServerNextResponse = DatabaseList; - -/** Optional parameters. */ -export interface FirewallRulesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type FirewallRulesCreateOrUpdateResponse = FirewallRule; - -/** Optional parameters. */ -export interface FirewallRulesDeleteOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type FirewallRulesDeleteResponse = FirewallRulesDeleteHeaders; - -/** Optional parameters. */ -export interface FirewallRulesGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type FirewallRulesGetResponse = FirewallRule; - -/** Optional parameters. */ -export interface FirewallRulesListByServerOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type FirewallRulesListByServerResponse = FirewallRuleList; - -/** Optional parameters. */ -export interface FirewallRulesListByServerNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type FirewallRulesListByServerNextResponse = FirewallRuleList; - -/** Optional parameters. */ -export interface BackupsLongTermRetentionCheckPrerequisitesOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the checkPrerequisites operation. */ -export type BackupsLongTermRetentionCheckPrerequisitesResponse = - BackupsLongTermRetentionCheckPrerequisitesHeaders & LtrPreBackupResponse; - -/** Optional parameters. */ -export interface BackupsLongTermRetentionStartOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the start operation. */ -export type BackupsLongTermRetentionStartResponse = BackupsLongTermRetentionStartHeaders & - BackupsLongTermRetentionResponse; - -/** Optional parameters. */ -export interface BackupsLongTermRetentionGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type BackupsLongTermRetentionGetResponse = BackupsLongTermRetentionOperation; - -/** Optional parameters. */ -export interface BackupsLongTermRetentionListByServerOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type BackupsLongTermRetentionListByServerResponse = LtrServerBackupOperationList; - -/** Optional parameters. */ -export interface BackupsLongTermRetentionListByServerNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type BackupsLongTermRetentionListByServerNextResponse = LtrServerBackupOperationList; - -/** Optional parameters. */ -export interface MigrationsCreateOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the create operation. */ -export type MigrationsCreateResponse = Migration; - -/** Optional parameters. */ -export interface MigrationsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type MigrationsGetResponse = Migration; - -/** Optional parameters. */ -export interface MigrationsUpdateOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the update operation. */ -export type MigrationsUpdateResponse = Migration; - -/** Optional parameters. */ -export interface MigrationsCancelOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the cancel operation. */ -export type MigrationsCancelResponse = Migration; - -/** Optional parameters. */ -export interface MigrationsListByTargetServerOptionalParams extends coreClient.OperationOptions { - /** Migration list filter. Indicates if the request should retrieve only active migrations or all migrations. Defaults to Active. */ - migrationListFilter?: MigrationListFilter; -} - -/** Contains response data for the listByTargetServer operation. */ -export type MigrationsListByTargetServerResponse = MigrationList; - -/** Optional parameters. */ -export interface MigrationsCheckNameAvailabilityOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the checkNameAvailability operation. */ -export type MigrationsCheckNameAvailabilityResponse = MigrationNameAvailability; - -/** Optional parameters. */ -export interface MigrationsListByTargetServerNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByTargetServerNext operation. */ -export type MigrationsListByTargetServerNextResponse = MigrationList; - -/** Optional parameters. */ -export interface NameAvailabilityCheckGloballyOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the checkGlobally operation. */ -export type NameAvailabilityCheckGloballyResponse = NameAvailabilityModel; - -/** Optional parameters. */ -export interface NameAvailabilityCheckWithLocationOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the checkWithLocation operation. */ -export type NameAvailabilityCheckWithLocationResponse = NameAvailabilityModel; - -/** Optional parameters. */ -export interface OperationsListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type OperationsListResponse = OperationList; - -/** Optional parameters. */ -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type OperationsListNextResponse = OperationList; - -/** Optional parameters. */ -export interface PrivateDnsZoneSuffixGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type PrivateDnsZoneSuffixGetResponse = { - /** The parsed response body. */ - body: string; -}; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type PrivateEndpointConnectionsUpdateResponse = PrivateEndpointConnection; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type PrivateEndpointConnectionsDeleteResponse = PrivateEndpointConnectionsDeleteHeaders; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsListByServerOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type PrivateEndpointConnectionsListByServerResponse = PrivateEndpointConnectionList; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsListByServerNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type PrivateEndpointConnectionsListByServerNextResponse = PrivateEndpointConnectionList; - -/** Optional parameters. */ -export interface PrivateLinkResourcesListByServerOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type PrivateLinkResourcesListByServerResponse = PrivateLinkResourceList; - -/** Optional parameters. */ -export interface PrivateLinkResourcesGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type PrivateLinkResourcesGetResponse = PrivateLinkResource; - -/** Optional parameters. */ -export interface PrivateLinkResourcesListByServerNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type PrivateLinkResourcesListByServerNextResponse = PrivateLinkResourceList; - -/** Optional parameters. */ -export interface QuotaUsagesListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type QuotaUsagesListResponse = QuotaUsageList; - -/** Optional parameters. */ -export interface QuotaUsagesListNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type QuotaUsagesListNextResponse = QuotaUsageList; - -/** Optional parameters. */ -export interface ReplicasListByServerOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type ReplicasListByServerResponse = ServerList; - -/** Optional parameters. */ -export interface ServersCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type ServersCreateOrUpdateResponse = Server; - -/** Optional parameters. */ -export interface ServersUpdateOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type ServersUpdateResponse = Server; - -/** Optional parameters. */ -export interface ServersDeleteOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type ServersDeleteResponse = ServersDeleteHeaders; - -/** Optional parameters. */ -export interface ServersGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type ServersGetResponse = Server; - -/** Optional parameters. */ -export interface ServersListByResourceGroupOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type ServersListByResourceGroupResponse = ServerList; - -/** Optional parameters. */ -export interface ServersListBySubscriptionOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscription operation. */ -export type ServersListBySubscriptionResponse = ServerList; - -/** Optional parameters. */ -export interface ServersRestartOptionalParams extends coreClient.OperationOptions { - /** Parameters to restart a server. */ - parameters?: RestartParameter; - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the restart operation. */ -export type ServersRestartResponse = ServersRestartHeaders; - -/** Optional parameters. */ -export interface ServersStartOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the start operation. */ -export type ServersStartResponse = ServersStartHeaders; - -/** Optional parameters. */ -export interface ServersStopOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the stop operation. */ -export type ServersStopResponse = ServersStopHeaders; - -/** Optional parameters. */ -export interface ServersListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type ServersListByResourceGroupNextResponse = ServerList; - -/** Optional parameters. */ -export interface ServersListBySubscriptionNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscriptionNext operation. */ -export type ServersListBySubscriptionNextResponse = ServerList; - -/** Optional parameters. */ -export interface TuningOptionsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type TuningOptionsGetResponse = TuningOptions; - -/** Optional parameters. */ -export interface TuningOptionsListRecommendationsOptionalParams - extends coreClient.OperationOptions { - /** Recommendations list filter. Retrieves recommendations based on type. */ - recommendationType?: RecommendationTypeParameterEnum; -} - -/** Contains response data for the listRecommendations operation. */ -export type TuningOptionsListRecommendationsResponse = ObjectRecommendationList; - -/** Optional parameters. */ -export interface TuningOptionsListByServerOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type TuningOptionsListByServerResponse = TuningOptionsList; - -/** Optional parameters. */ -export interface TuningOptionsListRecommendationsNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listRecommendationsNext operation. */ -export type TuningOptionsListRecommendationsNextResponse = ObjectRecommendationList; - -/** Optional parameters. */ -export interface TuningOptionsListByServerNextOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type TuningOptionsListByServerNextResponse = TuningOptionsList; - -/** Optional parameters. */ -export interface VirtualEndpointsCreateOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the create operation. */ -export type VirtualEndpointsCreateResponse = VirtualEndpoint; - -/** Optional parameters. */ -export interface VirtualEndpointsUpdateOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type VirtualEndpointsUpdateResponse = VirtualEndpoint; - -/** Optional parameters. */ -export interface VirtualEndpointsDeleteOptionalParams extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type VirtualEndpointsDeleteResponse = VirtualEndpointsDeleteHeaders; - -/** Optional parameters. */ -export interface VirtualEndpointsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type VirtualEndpointsGetResponse = VirtualEndpoint; - -/** Optional parameters. */ -export interface VirtualEndpointsListByServerOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the listByServer operation. */ -export type VirtualEndpointsListByServerResponse = VirtualEndpointsList; - -/** Optional parameters. */ -export interface VirtualEndpointsListByServerNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByServerNext operation. */ -export type VirtualEndpointsListByServerNextResponse = VirtualEndpointsList; - -/** Optional parameters. */ -export interface VirtualNetworkSubnetUsageListOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type VirtualNetworkSubnetUsageListResponse = VirtualNetworkSubnetUsageModel; - -/** Optional parameters. */ -export interface PostgreSQLManagementFlexibleServerClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +export type { + Operation, + OperationDisplay, + OperationOrigin, + OperationProperties, + ServiceSpecification, + MetricSpecification, + LogSpecification, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + Migration, + MigrationProperties, + MigrationStatus, + MigrationState, + MigrationSubstateDetails, + MigrationSubstate, + DatabaseMigrationState, + MigrationDatabaseState, + ValidationDetails, + ValidationState, + ValidationSummaryItem, + ValidationMessage, + DbLevelValidationStatus, + MigrationMode, + MigrationOption, + SourceType, + SslMode, + DbServerMetadata, + ServerSku, + SkuTier, + MigrationSecretParameters, + AdminCredentials, + LogicalReplicationOnSourceServer, + OverwriteDatabasesOnTargetServer, + MigrateRolesAndPermissions, + StartDataMigration, + TriggerCutover, + Cancel, + TrackedResource, + Resource, + SystemData, + CreatedByType, + MigrationResourceForPatch, + MigrationPropertiesForPatch, + MigrationSecretParametersForPatch, + AdminCredentialsForPatch, + MigrationNameAvailability, + MigrationNameAvailabilityReason, + Server, + ServerProperties, + PostgresMajorVersion, + ServerState, + Storage, + StorageAutoGrow, + AzureManagedDiskPerformanceTier, + StorageType, + AuthConfig, + MicrosoftEntraAuth, + PasswordBasedAuth, + DataEncryption, + DataEncryptionType, + EncryptionKeyStatus, + Backup, + GeographicallyRedundantBackup, + Network, + ServerPublicNetworkAccessState, + HighAvailability, + PostgreSqlFlexibleServerHighAvailabilityMode, + HighAvailabilityState, + MaintenanceWindow, + ReplicationRole, + Replica, + ReplicationState, + ReadReplicaPromoteMode, + ReadReplicaPromoteOption, + CreateMode, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + PrivateEndpointServiceConnectionStatus, + PrivateEndpointConnectionProvisioningState, + Cluster, + Sku, + UserAssignedIdentity, + UserIdentity, + IdentityType, + ServerForPatch, + SkuForPatch, + ServerPropertiesForPatch, + BackupForPatch, + HighAvailabilityForPatch, + MaintenanceWindowForPatch, + AuthConfigForPatch, + CreateModeForPatch, + RestartParameter, + FailoverMode, + MigrateNetworkStatus, + NetworkMigrationState, + Configuration, + ConfigurationProperties, + ConfigurationDataType, + ProxyResource, + ConfigurationForUpdate, + Database, + DatabaseProperties, + FirewallRule, + FirewallRuleProperties, + PrivateLinkResource, + PrivateLinkResourceProperties, + VirtualEndpoint, + VirtualEndpointResourceProperties, + VirtualEndpointType, + VirtualEndpointResourceForPatch, + AdministratorMicrosoftEntra, + AdministratorMicrosoftEntraProperties, + PrincipalType, + AdministratorMicrosoftEntraAdd, + AdministratorMicrosoftEntraPropertiesForAdd, + Capability, + ServerEditionCapability, + StorageEditionCapability, + StorageMbCapability, + StorageTierCapability, + ServerSkuCapability, + HighAvailabilityMode, + SupportedFeature, + FeatureStatus, + ServerVersionCapability, + FastProvisioningSupport, + FastProvisioningEditionCapability, + GeographicallyRedundantBackupSupport, + ZoneRedundantHighAvailabilitySupport, + ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport, + StorageAutoGrowthSupport, + OnlineStorageResizeSupport, + LocationRestricted, + CapabilityBase, + CapabilityStatus, + CapturedLog, + CapturedLogProperties, + LtrPreBackupRequest, + BackupRequestBase, + BackupSettings, + LtrPreBackupResponse, + BackupsLongTermRetentionResponseProperties, + BackupsLongTermRetentionRequest, + BackupStoreDetails, + BackupsLongTermRetentionResponse, + LtrBackupOperationResponseProperties, + ExecutionStatus, + BackupsLongTermRetentionOperation, + AdvancedThreatProtectionSettingsModel, + AdvancedThreatProtectionSettingsProperties, + ThreatProtectionState, + ThreatProtectionName, + BackupAutomaticAndOnDemand, + BackupAutomaticAndOnDemandProperties, + BackupType, + TuningOptions, + TuningOptionsProperties, + TuningOptionParameterEnum, + ObjectRecommendation, + ObjectRecommendationProperties, + RecommendationTypeEnum, + ObjectRecommendationPropertiesImplementationDetails, + ObjectRecommendationPropertiesAnalyzedWorkload, + ImpactRecord, + ObjectRecommendationDetails, + CheckNameAvailabilityRequest, + NameAvailabilityModel, + CheckNameAvailabilityResponse, + CheckNameAvailabilityReason, + QuotaUsage, + NameProperty, + VirtualNetworkSubnetUsageParameter, + VirtualNetworkSubnetUsageModel, + DelegatedSubnetUsage, + MigrationListFilter, + RecommendationTypeParameterEnum, + PrivateDnsZoneSuffixGetResponse, +} from "./models.js"; +export { + KnownOperationOrigin, + KnownMigrationState, + KnownMigrationSubstate, + KnownMigrationDatabaseState, + KnownValidationState, + KnownMigrationMode, + KnownMigrationOption, + KnownSourceType, + KnownSslMode, + KnownSkuTier, + KnownLogicalReplicationOnSourceServer, + KnownOverwriteDatabasesOnTargetServer, + KnownMigrateRolesAndPermissions, + KnownStartDataMigration, + KnownTriggerCutover, + KnownCancel, + KnownCreatedByType, + KnownMigrationNameAvailabilityReason, + KnownPostgresMajorVersion, + KnownServerState, + KnownStorageAutoGrow, + KnownAzureManagedDiskPerformanceTier, + KnownStorageType, + KnownMicrosoftEntraAuth, + KnownPasswordBasedAuth, + KnownDataEncryptionType, + KnownEncryptionKeyStatus, + KnownGeographicallyRedundantBackup, + KnownServerPublicNetworkAccessState, + KnownPostgreSqlFlexibleServerHighAvailabilityMode, + KnownHighAvailabilityState, + KnownReplicationRole, + KnownReplicationState, + KnownReadReplicaPromoteMode, + KnownReadReplicaPromoteOption, + KnownCreateMode, + KnownPrivateEndpointServiceConnectionStatus, + KnownPrivateEndpointConnectionProvisioningState, + KnownIdentityType, + KnownCreateModeForPatch, + KnownFailoverMode, + KnownNetworkMigrationState, + KnownConfigurationDataType, + KnownVirtualEndpointType, + KnownPrincipalType, + KnownHighAvailabilityMode, + KnownFeatureStatus, + KnownFastProvisioningSupport, + KnownGeographicallyRedundantBackupSupport, + KnownZoneRedundantHighAvailabilitySupport, + KnownZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport, + KnownStorageAutoGrowthSupport, + KnownOnlineStorageResizeSupport, + KnownLocationRestricted, + KnownExecutionStatus, + KnownThreatProtectionName, + KnownBackupType, + KnownTuningOptionParameterEnum, + KnownRecommendationTypeEnum, + KnownCheckNameAvailabilityReason, + KnownMigrationListFilter, + KnownRecommendationTypeParameterEnum, + KnownVersions, +} from "./models.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/models/mappers.ts b/sdk/postgresql/arm-postgresql-flexible/src/models/mappers.ts deleted file mode 100644 index c5b47902a5dd..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/models/mappers.ts +++ /dev/null @@ -1,4783 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type * as coreClient from "@azure/core-client"; - -export const AdministratorMicrosoftEntraAdd: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AdministratorMicrosoftEntraAdd", - modelProperties: { - principalType: { - serializedName: "properties.principalType", - type: { - name: "String", - }, - }, - principalName: { - serializedName: "properties.principalName", - type: { - name: "String", - }, - }, - tenantId: { - serializedName: "properties.tenantId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - }, - }, -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String", - }, - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String", - }, - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime", - }, - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String", - }, - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String", - }, - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const ErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, -}; - -export const ErrorDetail: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorDetail", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String", - }, - }, - target: { - serializedName: "target", - readOnly: true, - type: { - name: "String", - }, - }, - details: { - serializedName: "details", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, - additionalInfo: { - serializedName: "additionalInfo", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - }, - }, - }, - }, - }, - }, -}; - -export const ErrorAdditionalInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - modelProperties: { - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - info: { - serializedName: "info", - readOnly: true, - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - }, - }, -}; - -export const AdministratorMicrosoftEntraList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AdministratorMicrosoftEntraList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AdministratorMicrosoftEntra", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AdvancedThreatProtectionSettingsList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AdvancedThreatProtectionSettingsList", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AdvancedThreatProtectionSettingsModel", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const BackupAutomaticAndOnDemandList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupAutomaticAndOnDemandList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "BackupAutomaticAndOnDemand", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CapabilityList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CapabilityList", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Capability", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CapabilityBase: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CapabilityBase", - modelProperties: { - status: { - serializedName: "status", - readOnly: true, - type: { - name: "Enum", - allowedValues: ["Visible", "Available", "Default", "Disabled"], - }, - }, - reason: { - serializedName: "reason", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const SupportedFeature: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SupportedFeature", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - status: { - serializedName: "status", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CapturedLogList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CapturedLogList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CapturedLog", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ConfigurationList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ConfigurationList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Configuration", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ConfigurationForUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ConfigurationForUpdate", - modelProperties: { - value: { - serializedName: "properties.value", - type: { - name: "String", - }, - }, - description: { - serializedName: "properties.description", - readOnly: true, - type: { - name: "String", - }, - }, - defaultValue: { - serializedName: "properties.defaultValue", - readOnly: true, - type: { - name: "String", - }, - }, - dataType: { - serializedName: "properties.dataType", - readOnly: true, - type: { - name: "String", - }, - }, - allowedValues: { - serializedName: "properties.allowedValues", - readOnly: true, - type: { - name: "String", - }, - }, - source: { - serializedName: "properties.source", - type: { - name: "String", - }, - }, - isDynamicConfig: { - serializedName: "properties.isDynamicConfig", - readOnly: true, - type: { - name: "Boolean", - }, - }, - isReadOnly: { - serializedName: "properties.isReadOnly", - readOnly: true, - type: { - name: "Boolean", - }, - }, - isConfigPendingRestart: { - serializedName: "properties.isConfigPendingRestart", - readOnly: true, - type: { - name: "Boolean", - }, - }, - unit: { - serializedName: "properties.unit", - readOnly: true, - type: { - name: "String", - }, - }, - documentationLink: { - serializedName: "properties.documentationLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DatabaseList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatabaseList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Database", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const FirewallRuleList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FirewallRuleList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FirewallRule", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const BackupRequestBase: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupRequestBase", - modelProperties: { - backupSettings: { - serializedName: "backupSettings", - type: { - name: "Composite", - className: "BackupSettings", - }, - }, - }, - }, -}; - -export const BackupSettings: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupSettings", - modelProperties: { - backupName: { - serializedName: "backupName", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const LtrPreBackupResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LtrPreBackupResponse", - modelProperties: { - numberOfContainers: { - serializedName: "properties.numberOfContainers", - required: true, - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const BackupStoreDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupStoreDetails", - modelProperties: { - sasUriList: { - serializedName: "sasUriList", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const BackupsLongTermRetentionResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupsLongTermRetentionResponse", - modelProperties: { - datasourceSizeInBytes: { - serializedName: "properties.datasourceSizeInBytes", - type: { - name: "Number", - }, - }, - dataTransferredInBytes: { - serializedName: "properties.dataTransferredInBytes", - type: { - name: "Number", - }, - }, - backupName: { - serializedName: "properties.backupName", - type: { - name: "String", - }, - }, - backupMetadata: { - serializedName: "properties.backupMetadata", - type: { - name: "String", - }, - }, - status: { - serializedName: "properties.status", - type: { - name: "String", - }, - }, - startTime: { - serializedName: "properties.startTime", - type: { - name: "DateTime", - }, - }, - endTime: { - serializedName: "properties.endTime", - type: { - name: "DateTime", - }, - }, - percentComplete: { - constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 0, - }, - serializedName: "properties.percentComplete", - type: { - name: "Number", - }, - }, - errorCode: { - serializedName: "properties.errorCode", - readOnly: true, - type: { - name: "String", - }, - }, - errorMessage: { - serializedName: "properties.errorMessage", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const LtrServerBackupOperationList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LtrServerBackupOperationList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "BackupsLongTermRetentionOperation", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MigrationStatus: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MigrationStatus", - modelProperties: { - state: { - serializedName: "state", - readOnly: true, - type: { - name: "String", - }, - }, - error: { - serializedName: "error", - readOnly: true, - type: { - name: "String", - }, - }, - currentSubStateDetails: { - serializedName: "currentSubStateDetails", - type: { - name: "Composite", - className: "MigrationSubstateDetails", - }, - }, - }, - }, -}; - -export const MigrationSubstateDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MigrationSubstateDetails", - modelProperties: { - currentSubState: { - serializedName: "currentSubState", - readOnly: true, - type: { - name: "String", - }, - }, - dbDetails: { - serializedName: "dbDetails", - type: { - name: "Dictionary", - value: { - type: { name: "Composite", className: "DatabaseMigrationState" }, - }, - }, - }, - validationDetails: { - serializedName: "validationDetails", - type: { - name: "Composite", - className: "ValidationDetails", - }, - }, - }, - }, -}; - -export const DatabaseMigrationState: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatabaseMigrationState", - modelProperties: { - databaseName: { - serializedName: "databaseName", - type: { - name: "String", - }, - }, - migrationState: { - serializedName: "migrationState", - type: { - name: "String", - }, - }, - migrationOperation: { - serializedName: "migrationOperation", - type: { - name: "String", - }, - }, - startedOn: { - serializedName: "startedOn", - type: { - name: "DateTime", - }, - }, - endedOn: { - serializedName: "endedOn", - type: { - name: "DateTime", - }, - }, - fullLoadQueuedTables: { - serializedName: "fullLoadQueuedTables", - type: { - name: "Number", - }, - }, - fullLoadErroredTables: { - serializedName: "fullLoadErroredTables", - type: { - name: "Number", - }, - }, - fullLoadLoadingTables: { - serializedName: "fullLoadLoadingTables", - type: { - name: "Number", - }, - }, - fullLoadCompletedTables: { - serializedName: "fullLoadCompletedTables", - type: { - name: "Number", - }, - }, - cdcUpdateCounter: { - serializedName: "cdcUpdateCounter", - type: { - name: "Number", - }, - }, - cdcDeleteCounter: { - serializedName: "cdcDeleteCounter", - type: { - name: "Number", - }, - }, - cdcInsertCounter: { - serializedName: "cdcInsertCounter", - type: { - name: "Number", - }, - }, - appliedChanges: { - serializedName: "appliedChanges", - type: { - name: "Number", - }, - }, - incomingChanges: { - serializedName: "incomingChanges", - type: { - name: "Number", - }, - }, - latency: { - serializedName: "latency", - type: { - name: "Number", - }, - }, - message: { - serializedName: "message", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ValidationDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ValidationDetails", - modelProperties: { - status: { - serializedName: "status", - type: { - name: "String", - }, - }, - validationStartTimeInUtc: { - serializedName: "validationStartTimeInUtc", - type: { - name: "DateTime", - }, - }, - validationEndTimeInUtc: { - serializedName: "validationEndTimeInUtc", - type: { - name: "DateTime", - }, - }, - serverLevelValidationDetails: { - serializedName: "serverLevelValidationDetails", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ValidationSummaryItem", - }, - }, - }, - }, - dbLevelValidationDetails: { - serializedName: "dbLevelValidationDetails", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DbLevelValidationStatus", - }, - }, - }, - }, - }, - }, -}; - -export const ValidationSummaryItem: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ValidationSummaryItem", - modelProperties: { - type: { - serializedName: "type", - type: { - name: "String", - }, - }, - state: { - serializedName: "state", - type: { - name: "String", - }, - }, - messages: { - serializedName: "messages", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ValidationMessage", - }, - }, - }, - }, - }, - }, -}; - -export const ValidationMessage: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ValidationMessage", - modelProperties: { - state: { - serializedName: "state", - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DbLevelValidationStatus: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DbLevelValidationStatus", - modelProperties: { - databaseName: { - serializedName: "databaseName", - type: { - name: "String", - }, - }, - startedOn: { - serializedName: "startedOn", - type: { - name: "DateTime", - }, - }, - endedOn: { - serializedName: "endedOn", - type: { - name: "DateTime", - }, - }, - summary: { - serializedName: "summary", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ValidationSummaryItem", - }, - }, - }, - }, - }, - }, -}; - -export const DbServerMetadata: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DbServerMetadata", - modelProperties: { - location: { - serializedName: "location", - readOnly: true, - type: { - name: "String", - }, - }, - version: { - serializedName: "version", - type: { - name: "String", - }, - }, - storageMb: { - serializedName: "storageMb", - type: { - name: "Number", - }, - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "ServerSku", - }, - }, - }, - }, -}; - -export const ServerSku: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServerSku", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - tier: { - serializedName: "tier", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MigrationSecretParameters: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MigrationSecretParameters", - modelProperties: { - adminCredentials: { - serializedName: "adminCredentials", - type: { - name: "Composite", - className: "AdminCredentials", - }, - }, - sourceServerUsername: { - serializedName: "sourceServerUsername", - type: { - name: "String", - }, - }, - targetServerUsername: { - serializedName: "targetServerUsername", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AdminCredentials: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AdminCredentials", - modelProperties: { - sourceServerPassword: { - serializedName: "sourceServerPassword", - required: true, - type: { - name: "String", - }, - }, - targetServerPassword: { - serializedName: "targetServerPassword", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MigrationResourceForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MigrationResourceForPatch", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - sourceDbServerResourceId: { - serializedName: "properties.sourceDbServerResourceId", - type: { - name: "String", - }, - }, - sourceDbServerFullyQualifiedDomainName: { - serializedName: "properties.sourceDbServerFullyQualifiedDomainName", - type: { - name: "String", - }, - }, - targetDbServerFullyQualifiedDomainName: { - serializedName: "properties.targetDbServerFullyQualifiedDomainName", - type: { - name: "String", - }, - }, - secretParameters: { - serializedName: "properties.secretParameters", - type: { - name: "Composite", - className: "MigrationSecretParametersForPatch", - }, - }, - dbsToMigrate: { - constraints: { - MaxItems: 50, - }, - serializedName: "properties.dbsToMigrate", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - setupLogicalReplicationOnSourceDbIfNeeded: { - serializedName: "properties.setupLogicalReplicationOnSourceDbIfNeeded", - type: { - name: "String", - }, - }, - overwriteDbsInTarget: { - serializedName: "properties.overwriteDbsInTarget", - type: { - name: "String", - }, - }, - migrationWindowStartTimeInUtc: { - serializedName: "properties.migrationWindowStartTimeInUtc", - type: { - name: "DateTime", - }, - }, - migrateRoles: { - serializedName: "properties.migrateRoles", - type: { - name: "String", - }, - }, - startDataMigration: { - serializedName: "properties.startDataMigration", - type: { - name: "String", - }, - }, - triggerCutover: { - serializedName: "properties.triggerCutover", - type: { - name: "String", - }, - }, - dbsToTriggerCutoverOn: { - serializedName: "properties.dbsToTriggerCutoverOn", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - cancel: { - serializedName: "properties.cancel", - type: { - name: "String", - }, - }, - dbsToCancelMigrationOn: { - serializedName: "properties.dbsToCancelMigrationOn", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - migrationMode: { - serializedName: "properties.migrationMode", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MigrationSecretParametersForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MigrationSecretParametersForPatch", - modelProperties: { - adminCredentials: { - serializedName: "adminCredentials", - type: { - name: "Composite", - className: "AdminCredentialsForPatch", - }, - }, - sourceServerUsername: { - serializedName: "sourceServerUsername", - type: { - name: "String", - }, - }, - targetServerUsername: { - serializedName: "targetServerUsername", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AdminCredentialsForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AdminCredentialsForPatch", - modelProperties: { - sourceServerPassword: { - serializedName: "sourceServerPassword", - type: { - name: "String", - }, - }, - targetServerPassword: { - serializedName: "targetServerPassword", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MigrationList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MigrationList", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Migration", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MigrationNameAvailability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MigrationNameAvailability", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - required: true, - type: { - name: "String", - }, - }, - nameAvailable: { - serializedName: "nameAvailable", - readOnly: true, - type: { - name: "Boolean", - }, - }, - reason: { - serializedName: "reason", - readOnly: true, - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CheckNameAvailabilityRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CheckNameAvailabilityRequest", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CheckNameAvailabilityResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CheckNameAvailabilityResponse", - modelProperties: { - nameAvailable: { - serializedName: "nameAvailable", - type: { - name: "Boolean", - }, - }, - reason: { - serializedName: "reason", - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const OperationList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Operation", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Operation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay", - }, - }, - isDataAction: { - serializedName: "isDataAction", - type: { - name: "Boolean", - }, - }, - origin: { - serializedName: "origin", - readOnly: true, - type: { - name: "String", - }, - }, - properties: { - serializedName: "properties", - readOnly: true, - type: { - name: "Dictionary", - value: { - type: { name: "Dictionary", value: { type: { name: "any" } } }, - }, - }, - }, - }, - }, -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - readOnly: true, - type: { - name: "String", - }, - }, - resource: { - serializedName: "resource", - readOnly: true, - type: { - name: "String", - }, - }, - operation: { - serializedName: "operation", - readOnly: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpoint: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpoint", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateLinkServiceConnectionState: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateLinkServiceConnectionState", - modelProperties: { - status: { - serializedName: "status", - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - type: { - name: "String", - }, - }, - actionsRequired: { - serializedName: "actionsRequired", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnectionList", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PrivateEndpointConnection", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateLinkResourceList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateLinkResourceList", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PrivateLinkResource", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const QuotaUsageList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QuotaUsageList", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "QuotaUsage", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const QuotaUsage: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QuotaUsage", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "Composite", - className: "NameProperty", - }, - }, - limit: { - serializedName: "limit", - type: { - name: "Number", - }, - }, - unit: { - defaultValue: "Count", - serializedName: "unit", - type: { - name: "String", - }, - }, - currentValue: { - serializedName: "currentValue", - type: { - name: "Number", - }, - }, - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NameProperty: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NameProperty", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "String", - }, - }, - localizedValue: { - serializedName: "localizedValue", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServerList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServerList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Server", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Sku: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Sku", - modelProperties: { - name: { - serializedName: "name", - required: true, - type: { - name: "String", - }, - }, - tier: { - serializedName: "tier", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const UserAssignedIdentity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserAssignedIdentity", - modelProperties: { - userAssignedIdentities: { - serializedName: "userAssignedIdentities", - type: { - name: "Dictionary", - value: { type: { name: "Composite", className: "UserIdentity" } }, - }, - }, - principalId: { - serializedName: "principalId", - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - required: true, - type: { - name: "String", - }, - }, - tenantId: { - serializedName: "tenantId", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const UserIdentity: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserIdentity", - modelProperties: { - principalId: { - serializedName: "principalId", - type: { - name: "String", - }, - }, - clientId: { - serializedName: "clientId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Storage: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Storage", - modelProperties: { - storageSizeGB: { - serializedName: "storageSizeGB", - type: { - name: "Number", - }, - }, - autoGrow: { - serializedName: "autoGrow", - type: { - name: "String", - }, - }, - tier: { - serializedName: "tier", - type: { - name: "String", - }, - }, - iops: { - serializedName: "iops", - type: { - name: "Number", - }, - }, - throughput: { - serializedName: "throughput", - type: { - name: "Number", - }, - }, - type: { - serializedName: "type", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AuthConfig: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AuthConfig", - modelProperties: { - activeDirectoryAuth: { - serializedName: "activeDirectoryAuth", - type: { - name: "String", - }, - }, - passwordAuth: { - serializedName: "passwordAuth", - type: { - name: "String", - }, - }, - tenantId: { - defaultValue: "", - serializedName: "tenantId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DataEncryption: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DataEncryption", - modelProperties: { - primaryKeyURI: { - serializedName: "primaryKeyURI", - type: { - name: "String", - }, - }, - primaryUserAssignedIdentityId: { - serializedName: "primaryUserAssignedIdentityId", - type: { - name: "String", - }, - }, - geoBackupKeyURI: { - serializedName: "geoBackupKeyURI", - type: { - name: "String", - }, - }, - geoBackupUserAssignedIdentityId: { - serializedName: "geoBackupUserAssignedIdentityId", - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - type: { - name: "String", - }, - }, - primaryEncryptionKeyStatus: { - serializedName: "primaryEncryptionKeyStatus", - type: { - name: "String", - }, - }, - geoBackupEncryptionKeyStatus: { - serializedName: "geoBackupEncryptionKeyStatus", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Backup: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Backup", - modelProperties: { - backupRetentionDays: { - defaultValue: 7, - serializedName: "backupRetentionDays", - type: { - name: "Number", - }, - }, - geoRedundantBackup: { - serializedName: "geoRedundantBackup", - type: { - name: "String", - }, - }, - earliestRestoreDate: { - serializedName: "earliestRestoreDate", - readOnly: true, - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const Network: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Network", - modelProperties: { - publicNetworkAccess: { - serializedName: "publicNetworkAccess", - type: { - name: "String", - }, - }, - delegatedSubnetResourceId: { - serializedName: "delegatedSubnetResourceId", - type: { - name: "String", - }, - }, - privateDnsZoneArmResourceId: { - serializedName: "privateDnsZoneArmResourceId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const HighAvailability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "HighAvailability", - modelProperties: { - mode: { - serializedName: "mode", - type: { - name: "String", - }, - }, - state: { - serializedName: "state", - readOnly: true, - type: { - name: "String", - }, - }, - standbyAvailabilityZone: { - defaultValue: "", - serializedName: "standbyAvailabilityZone", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MaintenanceWindow: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MaintenanceWindow", - modelProperties: { - customWindow: { - defaultValue: "Disabled", - serializedName: "customWindow", - type: { - name: "String", - }, - }, - startHour: { - defaultValue: 0, - serializedName: "startHour", - type: { - name: "Number", - }, - }, - startMinute: { - defaultValue: 0, - serializedName: "startMinute", - type: { - name: "Number", - }, - }, - dayOfWeek: { - defaultValue: 0, - serializedName: "dayOfWeek", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const Replica: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Replica", - modelProperties: { - role: { - serializedName: "role", - type: { - name: "String", - }, - }, - capacity: { - serializedName: "capacity", - readOnly: true, - type: { - name: "Number", - }, - }, - replicationState: { - serializedName: "replicationState", - readOnly: true, - type: { - name: "String", - }, - }, - promoteMode: { - serializedName: "promoteMode", - type: { - name: "String", - }, - }, - promoteOption: { - serializedName: "promoteOption", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Cluster: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Cluster", - modelProperties: { - clusterSize: { - defaultValue: 0, - serializedName: "clusterSize", - type: { - name: "Number", - }, - }, - defaultDatabaseName: { - serializedName: "defaultDatabaseName", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServerForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServerForPatch", - modelProperties: { - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "SkuForPatch", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "UserAssignedIdentity", - }, - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - administratorLogin: { - serializedName: "properties.administratorLogin", - type: { - name: "String", - }, - }, - administratorLoginPassword: { - serializedName: "properties.administratorLoginPassword", - type: { - name: "String", - }, - }, - version: { - serializedName: "properties.version", - type: { - name: "String", - }, - }, - storage: { - serializedName: "properties.storage", - type: { - name: "Composite", - className: "Storage", - }, - }, - backup: { - serializedName: "properties.backup", - type: { - name: "Composite", - className: "BackupForPatch", - }, - }, - highAvailability: { - serializedName: "properties.highAvailability", - type: { - name: "Composite", - className: "HighAvailabilityForPatch", - }, - }, - maintenanceWindow: { - serializedName: "properties.maintenanceWindow", - type: { - name: "Composite", - className: "MaintenanceWindowForPatch", - }, - }, - authConfig: { - serializedName: "properties.authConfig", - type: { - name: "Composite", - className: "AuthConfigForPatch", - }, - }, - dataEncryption: { - serializedName: "properties.dataEncryption", - type: { - name: "Composite", - className: "DataEncryption", - }, - }, - availabilityZone: { - defaultValue: "", - serializedName: "properties.availabilityZone", - type: { - name: "String", - }, - }, - createMode: { - serializedName: "properties.createMode", - type: { - name: "String", - }, - }, - replicationRole: { - serializedName: "properties.replicationRole", - type: { - name: "String", - }, - }, - replica: { - serializedName: "properties.replica", - type: { - name: "Composite", - className: "Replica", - }, - }, - network: { - serializedName: "properties.network", - type: { - name: "Composite", - className: "Network", - }, - }, - cluster: { - serializedName: "properties.cluster", - type: { - name: "Composite", - className: "Cluster", - }, - }, - }, - }, -}; - -export const SkuForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SkuForPatch", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - tier: { - serializedName: "tier", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const BackupForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupForPatch", - modelProperties: { - backupRetentionDays: { - serializedName: "backupRetentionDays", - type: { - name: "Number", - }, - }, - geoRedundantBackup: { - serializedName: "geoRedundantBackup", - type: { - name: "String", - }, - }, - earliestRestoreDate: { - serializedName: "earliestRestoreDate", - readOnly: true, - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const HighAvailabilityForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "HighAvailabilityForPatch", - modelProperties: { - mode: { - serializedName: "mode", - type: { - name: "String", - }, - }, - state: { - serializedName: "state", - readOnly: true, - type: { - name: "String", - }, - }, - standbyAvailabilityZone: { - defaultValue: "", - serializedName: "standbyAvailabilityZone", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MaintenanceWindowForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MaintenanceWindowForPatch", - modelProperties: { - customWindow: { - serializedName: "customWindow", - type: { - name: "String", - }, - }, - startHour: { - serializedName: "startHour", - type: { - name: "Number", - }, - }, - startMinute: { - serializedName: "startMinute", - type: { - name: "Number", - }, - }, - dayOfWeek: { - serializedName: "dayOfWeek", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const AuthConfigForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AuthConfigForPatch", - modelProperties: { - activeDirectoryAuth: { - serializedName: "activeDirectoryAuth", - type: { - name: "String", - }, - }, - passwordAuth: { - serializedName: "passwordAuth", - type: { - name: "String", - }, - }, - tenantId: { - serializedName: "tenantId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const RestartParameter: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "RestartParameter", - modelProperties: { - restartWithFailover: { - serializedName: "restartWithFailover", - type: { - name: "Boolean", - }, - }, - failoverMode: { - serializedName: "failoverMode", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ObjectRecommendationList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ObjectRecommendationList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ObjectRecommendation", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ObjectRecommendationPropertiesImplementationDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ObjectRecommendationPropertiesImplementationDetails", - modelProperties: { - method: { - serializedName: "method", - type: { - name: "String", - }, - }, - script: { - serializedName: "script", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ObjectRecommendationPropertiesAnalyzedWorkload: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ObjectRecommendationPropertiesAnalyzedWorkload", - modelProperties: { - startTime: { - serializedName: "startTime", - type: { - name: "DateTime", - }, - }, - endTime: { - serializedName: "endTime", - type: { - name: "DateTime", - }, - }, - queryCount: { - serializedName: "queryCount", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const ImpactRecord: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ImpactRecord", - modelProperties: { - dimensionName: { - serializedName: "dimensionName", - type: { - name: "String", - }, - }, - unit: { - serializedName: "unit", - type: { - name: "String", - }, - }, - queryId: { - serializedName: "queryId", - type: { - name: "Number", - }, - }, - absoluteValue: { - serializedName: "absoluteValue", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const ObjectRecommendationDetails: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ObjectRecommendationDetails", - modelProperties: { - databaseName: { - serializedName: "databaseName", - type: { - name: "String", - }, - }, - schema: { - serializedName: "schema", - type: { - name: "String", - }, - }, - table: { - serializedName: "table", - type: { - name: "String", - }, - }, - indexType: { - serializedName: "indexType", - type: { - name: "String", - }, - }, - indexName: { - serializedName: "indexName", - type: { - name: "String", - }, - }, - indexColumns: { - serializedName: "indexColumns", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - includedColumns: { - serializedName: "includedColumns", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const TuningOptionsList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TuningOptionsList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "TuningOptions", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const VirtualEndpointResourceForPatch: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "VirtualEndpointResourceForPatch", - modelProperties: { - endpointType: { - serializedName: "properties.endpointType", - type: { - name: "String", - }, - }, - members: { - serializedName: "properties.members", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - virtualEndpoints: { - serializedName: "properties.virtualEndpoints", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const VirtualEndpointsList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "VirtualEndpointsList", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "VirtualEndpoint", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const VirtualNetworkSubnetUsageParameter: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "VirtualNetworkSubnetUsageParameter", - modelProperties: { - virtualNetworkArmResourceId: { - serializedName: "virtualNetworkArmResourceId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const VirtualNetworkSubnetUsageModel: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "VirtualNetworkSubnetUsageModel", - modelProperties: { - delegatedSubnetsUsage: { - serializedName: "delegatedSubnetsUsage", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DelegatedSubnetUsage", - }, - }, - }, - }, - location: { - serializedName: "location", - readOnly: true, - type: { - name: "String", - }, - }, - subscriptionId: { - serializedName: "subscriptionId", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DelegatedSubnetUsage: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DelegatedSubnetUsage", - modelProperties: { - subnetName: { - serializedName: "subnetName", - readOnly: true, - type: { - name: "String", - }, - }, - usage: { - serializedName: "usage", - readOnly: true, - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const ProxyResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProxyResource", - modelProperties: { - ...Resource.type.modelProperties, - }, - }, -}; - -export const TrackedResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TrackedResource", - modelProperties: { - ...Resource.type.modelProperties, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - location: { - serializedName: "location", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnection: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnection", - modelProperties: { - ...Resource.type.modelProperties, - groupIds: { - serializedName: "properties.groupIds", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - privateEndpoint: { - serializedName: "properties.privateEndpoint", - type: { - name: "Composite", - className: "PrivateEndpoint", - }, - }, - privateLinkServiceConnectionState: { - serializedName: "properties.privateLinkServiceConnectionState", - type: { - name: "Composite", - className: "PrivateLinkServiceConnectionState", - }, - }, - provisioningState: { - serializedName: "properties.provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateLinkResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateLinkResource", - modelProperties: { - ...Resource.type.modelProperties, - groupId: { - serializedName: "properties.groupId", - readOnly: true, - type: { - name: "String", - }, - }, - requiredMembers: { - serializedName: "properties.requiredMembers", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - requiredZoneNames: { - serializedName: "properties.requiredZoneNames", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const VirtualEndpoint: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "VirtualEndpoint", - modelProperties: { - ...VirtualEndpointResourceForPatch.type.modelProperties, - ...Resource.type.modelProperties, - }, - }, -}; - -export const StorageTierCapability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "StorageTierCapability", - modelProperties: { - ...CapabilityBase.type.modelProperties, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - iops: { - serializedName: "iops", - readOnly: true, - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const StorageMbCapability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "StorageMbCapability", - modelProperties: { - ...CapabilityBase.type.modelProperties, - supportedIops: { - serializedName: "supportedIops", - readOnly: true, - type: { - name: "Number", - }, - }, - supportedMaximumIops: { - serializedName: "supportedMaximumIops", - readOnly: true, - type: { - name: "Number", - }, - }, - storageSizeMb: { - serializedName: "storageSizeMb", - readOnly: true, - type: { - name: "Number", - }, - }, - maximumStorageSizeMb: { - serializedName: "maximumStorageSizeMb", - readOnly: true, - type: { - name: "Number", - }, - }, - supportedThroughput: { - serializedName: "supportedThroughput", - readOnly: true, - type: { - name: "Number", - }, - }, - supportedMaximumThroughput: { - serializedName: "supportedMaximumThroughput", - readOnly: true, - type: { - name: "Number", - }, - }, - defaultIopsTier: { - serializedName: "defaultIopsTier", - readOnly: true, - type: { - name: "String", - }, - }, - supportedIopsTiers: { - serializedName: "supportedIopsTiers", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "StorageTierCapability", - }, - }, - }, - }, - }, - }, -}; - -export const StorageEditionCapability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "StorageEditionCapability", - modelProperties: { - ...CapabilityBase.type.modelProperties, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - defaultStorageSizeMb: { - serializedName: "defaultStorageSizeMb", - readOnly: true, - type: { - name: "Number", - }, - }, - supportedStorageMb: { - serializedName: "supportedStorageMb", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "StorageMbCapability", - }, - }, - }, - }, - }, - }, -}; - -export const ServerSkuCapability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServerSkuCapability", - modelProperties: { - ...CapabilityBase.type.modelProperties, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - vCores: { - serializedName: "vCores", - readOnly: true, - type: { - name: "Number", - }, - }, - supportedIops: { - serializedName: "supportedIops", - readOnly: true, - type: { - name: "Number", - }, - }, - supportedMemoryPerVcoreMb: { - serializedName: "supportedMemoryPerVcoreMb", - readOnly: true, - type: { - name: "Number", - }, - }, - supportedZones: { - serializedName: "supportedZones", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - supportedHaMode: { - serializedName: "supportedHaMode", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - supportedFeatures: { - serializedName: "supportedFeatures", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SupportedFeature", - }, - }, - }, - }, - securityProfile: { - serializedName: "securityProfile", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServerEditionCapability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServerEditionCapability", - modelProperties: { - ...CapabilityBase.type.modelProperties, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - defaultSkuName: { - serializedName: "defaultSkuName", - readOnly: true, - type: { - name: "String", - }, - }, - supportedStorageEditions: { - serializedName: "supportedStorageEditions", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "StorageEditionCapability", - }, - }, - }, - }, - supportedServerSkus: { - serializedName: "supportedServerSkus", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ServerSkuCapability", - }, - }, - }, - }, - }, - }, -}; - -export const ServerVersionCapability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServerVersionCapability", - modelProperties: { - ...CapabilityBase.type.modelProperties, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - supportedVersionsToUpgrade: { - serializedName: "supportedVersionsToUpgrade", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - supportedFeatures: { - serializedName: "supportedFeatures", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SupportedFeature", - }, - }, - }, - }, - }, - }, -}; - -export const FastProvisioningEditionCapability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FastProvisioningEditionCapability", - modelProperties: { - ...CapabilityBase.type.modelProperties, - supportedTier: { - serializedName: "supportedTier", - readOnly: true, - type: { - name: "String", - }, - }, - supportedSku: { - serializedName: "supportedSku", - readOnly: true, - type: { - name: "String", - }, - }, - supportedStorageGb: { - serializedName: "supportedStorageGb", - readOnly: true, - type: { - name: "Number", - }, - }, - supportedServerVersions: { - serializedName: "supportedServerVersions", - readOnly: true, - type: { - name: "String", - }, - }, - serverCount: { - serializedName: "serverCount", - readOnly: true, - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const Capability: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Capability", - modelProperties: { - ...CapabilityBase.type.modelProperties, - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - supportedServerEditions: { - serializedName: "supportedServerEditions", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ServerEditionCapability", - }, - }, - }, - }, - supportedServerVersions: { - serializedName: "supportedServerVersions", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ServerVersionCapability", - }, - }, - }, - }, - supportedFeatures: { - serializedName: "supportedFeatures", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SupportedFeature", - }, - }, - }, - }, - fastProvisioningSupported: { - serializedName: "fastProvisioningSupported", - readOnly: true, - type: { - name: "String", - }, - }, - supportedFastProvisioningEditions: { - serializedName: "supportedFastProvisioningEditions", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FastProvisioningEditionCapability", - }, - }, - }, - }, - geoBackupSupported: { - serializedName: "geoBackupSupported", - readOnly: true, - type: { - name: "String", - }, - }, - zoneRedundantHaSupported: { - serializedName: "zoneRedundantHaSupported", - readOnly: true, - type: { - name: "String", - }, - }, - zoneRedundantHaAndGeoBackupSupported: { - serializedName: "zoneRedundantHaAndGeoBackupSupported", - readOnly: true, - type: { - name: "String", - }, - }, - storageAutoGrowthSupported: { - serializedName: "storageAutoGrowthSupported", - readOnly: true, - type: { - name: "String", - }, - }, - onlineResizeSupported: { - serializedName: "onlineResizeSupported", - readOnly: true, - type: { - name: "String", - }, - }, - restricted: { - serializedName: "restricted", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const LtrPreBackupRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LtrPreBackupRequest", - modelProperties: { - ...BackupRequestBase.type.modelProperties, - }, - }, -}; - -export const BackupsLongTermRetentionRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupsLongTermRetentionRequest", - modelProperties: { - ...BackupRequestBase.type.modelProperties, - targetDetails: { - serializedName: "targetDetails", - type: { - name: "Composite", - className: "BackupStoreDetails", - }, - }, - }, - }, -}; - -export const NameAvailabilityModel: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NameAvailabilityModel", - modelProperties: { - ...CheckNameAvailabilityResponse.type.modelProperties, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AdministratorMicrosoftEntra: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AdministratorMicrosoftEntra", - modelProperties: { - ...ProxyResource.type.modelProperties, - principalType: { - serializedName: "properties.principalType", - type: { - name: "String", - }, - }, - principalName: { - serializedName: "properties.principalName", - type: { - name: "String", - }, - }, - objectId: { - serializedName: "properties.objectId", - type: { - name: "String", - }, - }, - tenantId: { - serializedName: "properties.tenantId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AdvancedThreatProtectionSettingsModel: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AdvancedThreatProtectionSettingsModel", - modelProperties: { - ...ProxyResource.type.modelProperties, - state: { - serializedName: "properties.state", - type: { - name: "Enum", - allowedValues: ["Enabled", "Disabled"], - }, - }, - creationTime: { - serializedName: "properties.creationTime", - readOnly: true, - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const BackupAutomaticAndOnDemand: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupAutomaticAndOnDemand", - modelProperties: { - ...ProxyResource.type.modelProperties, - backupType: { - serializedName: "properties.backupType", - type: { - name: "String", - }, - }, - completedTime: { - serializedName: "properties.completedTime", - type: { - name: "DateTime", - }, - }, - source: { - serializedName: "properties.source", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CapturedLog: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CapturedLog", - modelProperties: { - ...ProxyResource.type.modelProperties, - createdTime: { - serializedName: "properties.createdTime", - type: { - name: "DateTime", - }, - }, - lastModifiedTime: { - serializedName: "properties.lastModifiedTime", - type: { - name: "DateTime", - }, - }, - sizeInKb: { - serializedName: "properties.sizeInKb", - type: { - name: "Number", - }, - }, - typePropertiesType: { - serializedName: "properties.type", - type: { - name: "String", - }, - }, - url: { - serializedName: "properties.url", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Configuration: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Configuration", - modelProperties: { - ...ProxyResource.type.modelProperties, - value: { - serializedName: "properties.value", - type: { - name: "String", - }, - }, - description: { - serializedName: "properties.description", - readOnly: true, - type: { - name: "String", - }, - }, - defaultValue: { - serializedName: "properties.defaultValue", - readOnly: true, - type: { - name: "String", - }, - }, - dataType: { - serializedName: "properties.dataType", - readOnly: true, - type: { - name: "String", - }, - }, - allowedValues: { - serializedName: "properties.allowedValues", - readOnly: true, - type: { - name: "String", - }, - }, - source: { - serializedName: "properties.source", - type: { - name: "String", - }, - }, - isDynamicConfig: { - serializedName: "properties.isDynamicConfig", - readOnly: true, - type: { - name: "Boolean", - }, - }, - isReadOnly: { - serializedName: "properties.isReadOnly", - readOnly: true, - type: { - name: "Boolean", - }, - }, - isConfigPendingRestart: { - serializedName: "properties.isConfigPendingRestart", - readOnly: true, - type: { - name: "Boolean", - }, - }, - unit: { - serializedName: "properties.unit", - readOnly: true, - type: { - name: "String", - }, - }, - documentationLink: { - serializedName: "properties.documentationLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Database: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Database", - modelProperties: { - ...ProxyResource.type.modelProperties, - charset: { - constraints: { - Pattern: new RegExp("^[a-zA-Z]+\\w*$"), - }, - serializedName: "properties.charset", - type: { - name: "String", - }, - }, - collation: { - constraints: { - Pattern: new RegExp("^[a-zA-Z\\-]+([. ]|\\w)*$"), - }, - serializedName: "properties.collation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const FirewallRule: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FirewallRule", - modelProperties: { - ...ProxyResource.type.modelProperties, - startIpAddress: { - constraints: { - Pattern: new RegExp( - "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", - ), - }, - serializedName: "properties.startIpAddress", - required: true, - type: { - name: "String", - }, - }, - endIpAddress: { - constraints: { - Pattern: new RegExp( - "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", - ), - }, - serializedName: "properties.endIpAddress", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const BackupsLongTermRetentionOperation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupsLongTermRetentionOperation", - modelProperties: { - ...ProxyResource.type.modelProperties, - datasourceSizeInBytes: { - serializedName: "properties.datasourceSizeInBytes", - type: { - name: "Number", - }, - }, - dataTransferredInBytes: { - serializedName: "properties.dataTransferredInBytes", - type: { - name: "Number", - }, - }, - backupName: { - serializedName: "properties.backupName", - type: { - name: "String", - }, - }, - backupMetadata: { - serializedName: "properties.backupMetadata", - type: { - name: "String", - }, - }, - status: { - serializedName: "properties.status", - type: { - name: "String", - }, - }, - startTime: { - serializedName: "properties.startTime", - type: { - name: "DateTime", - }, - }, - endTime: { - serializedName: "properties.endTime", - type: { - name: "DateTime", - }, - }, - percentComplete: { - constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 0, - }, - serializedName: "properties.percentComplete", - type: { - name: "Number", - }, - }, - errorCode: { - serializedName: "properties.errorCode", - readOnly: true, - type: { - name: "String", - }, - }, - errorMessage: { - serializedName: "properties.errorMessage", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const TuningOptions: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TuningOptions", - modelProperties: { - ...ProxyResource.type.modelProperties, - }, - }, -}; - -export const ObjectRecommendation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ObjectRecommendation", - modelProperties: { - ...ProxyResource.type.modelProperties, - kind: { - serializedName: "kind", - type: { - name: "String", - }, - }, - initialRecommendedTime: { - serializedName: "properties.initialRecommendedTime", - type: { - name: "DateTime", - }, - }, - lastRecommendedTime: { - serializedName: "properties.lastRecommendedTime", - type: { - name: "DateTime", - }, - }, - timesRecommended: { - serializedName: "properties.timesRecommended", - type: { - name: "Number", - }, - }, - improvedQueryIds: { - serializedName: "properties.improvedQueryIds", - type: { - name: "Sequence", - element: { - type: { - name: "Number", - }, - }, - }, - }, - recommendationReason: { - serializedName: "properties.recommendationReason", - type: { - name: "String", - }, - }, - currentState: { - serializedName: "properties.currentState", - type: { - name: "String", - }, - }, - recommendationType: { - serializedName: "properties.recommendationType", - type: { - name: "String", - }, - }, - implementationDetails: { - serializedName: "properties.implementationDetails", - type: { - name: "Composite", - className: "ObjectRecommendationPropertiesImplementationDetails", - }, - }, - analyzedWorkload: { - serializedName: "properties.analyzedWorkload", - type: { - name: "Composite", - className: "ObjectRecommendationPropertiesAnalyzedWorkload", - }, - }, - estimatedImpact: { - serializedName: "properties.estimatedImpact", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ImpactRecord", - }, - }, - }, - }, - details: { - serializedName: "properties.details", - type: { - name: "Composite", - className: "ObjectRecommendationDetails", - }, - }, - }, - }, -}; - -export const Migration: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Migration", - modelProperties: { - ...TrackedResource.type.modelProperties, - migrationId: { - serializedName: "properties.migrationId", - readOnly: true, - type: { - name: "String", - }, - }, - currentStatus: { - serializedName: "properties.currentStatus", - type: { - name: "Composite", - className: "MigrationStatus", - }, - }, - migrationInstanceResourceId: { - serializedName: "properties.migrationInstanceResourceId", - type: { - name: "String", - }, - }, - migrationMode: { - serializedName: "properties.migrationMode", - type: { - name: "String", - }, - }, - migrationOption: { - serializedName: "properties.migrationOption", - type: { - name: "String", - }, - }, - sourceType: { - serializedName: "properties.sourceType", - type: { - name: "String", - }, - }, - sslMode: { - serializedName: "properties.sslMode", - type: { - name: "String", - }, - }, - sourceDbServerMetadata: { - serializedName: "properties.sourceDbServerMetadata", - type: { - name: "Composite", - className: "DbServerMetadata", - }, - }, - targetDbServerMetadata: { - serializedName: "properties.targetDbServerMetadata", - type: { - name: "Composite", - className: "DbServerMetadata", - }, - }, - sourceDbServerResourceId: { - serializedName: "properties.sourceDbServerResourceId", - type: { - name: "String", - }, - }, - sourceDbServerFullyQualifiedDomainName: { - serializedName: "properties.sourceDbServerFullyQualifiedDomainName", - type: { - name: "String", - }, - }, - targetDbServerResourceId: { - serializedName: "properties.targetDbServerResourceId", - readOnly: true, - type: { - name: "String", - }, - }, - targetDbServerFullyQualifiedDomainName: { - serializedName: "properties.targetDbServerFullyQualifiedDomainName", - type: { - name: "String", - }, - }, - secretParameters: { - serializedName: "properties.secretParameters", - type: { - name: "Composite", - className: "MigrationSecretParameters", - }, - }, - dbsToMigrate: { - constraints: { - MaxItems: 50, - }, - serializedName: "properties.dbsToMigrate", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - setupLogicalReplicationOnSourceDbIfNeeded: { - serializedName: "properties.setupLogicalReplicationOnSourceDbIfNeeded", - type: { - name: "String", - }, - }, - overwriteDbsInTarget: { - serializedName: "properties.overwriteDbsInTarget", - type: { - name: "String", - }, - }, - migrationWindowStartTimeInUtc: { - serializedName: "properties.migrationWindowStartTimeInUtc", - type: { - name: "DateTime", - }, - }, - migrationWindowEndTimeInUtc: { - serializedName: "properties.migrationWindowEndTimeInUtc", - type: { - name: "DateTime", - }, - }, - migrateRoles: { - serializedName: "properties.migrateRoles", - type: { - name: "String", - }, - }, - startDataMigration: { - serializedName: "properties.startDataMigration", - type: { - name: "String", - }, - }, - triggerCutover: { - serializedName: "properties.triggerCutover", - type: { - name: "String", - }, - }, - dbsToTriggerCutoverOn: { - serializedName: "properties.dbsToTriggerCutoverOn", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - cancel: { - serializedName: "properties.cancel", - type: { - name: "String", - }, - }, - dbsToCancelMigrationOn: { - serializedName: "properties.dbsToCancelMigrationOn", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const Server: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Server", - modelProperties: { - ...TrackedResource.type.modelProperties, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "Sku", - }, - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "UserAssignedIdentity", - }, - }, - administratorLogin: { - serializedName: "properties.administratorLogin", - type: { - name: "String", - }, - }, - administratorLoginPassword: { - serializedName: "properties.administratorLoginPassword", - type: { - name: "String", - }, - }, - version: { - serializedName: "properties.version", - type: { - name: "String", - }, - }, - minorVersion: { - serializedName: "properties.minorVersion", - readOnly: true, - type: { - name: "String", - }, - }, - state: { - serializedName: "properties.state", - readOnly: true, - type: { - name: "String", - }, - }, - fullyQualifiedDomainName: { - serializedName: "properties.fullyQualifiedDomainName", - readOnly: true, - type: { - name: "String", - }, - }, - storage: { - serializedName: "properties.storage", - type: { - name: "Composite", - className: "Storage", - }, - }, - authConfig: { - serializedName: "properties.authConfig", - type: { - name: "Composite", - className: "AuthConfig", - }, - }, - dataEncryption: { - serializedName: "properties.dataEncryption", - type: { - name: "Composite", - className: "DataEncryption", - }, - }, - backup: { - serializedName: "properties.backup", - type: { - name: "Composite", - className: "Backup", - }, - }, - network: { - serializedName: "properties.network", - type: { - name: "Composite", - className: "Network", - }, - }, - highAvailability: { - serializedName: "properties.highAvailability", - type: { - name: "Composite", - className: "HighAvailability", - }, - }, - maintenanceWindow: { - serializedName: "properties.maintenanceWindow", - type: { - name: "Composite", - className: "MaintenanceWindow", - }, - }, - sourceServerResourceId: { - serializedName: "properties.sourceServerResourceId", - type: { - name: "String", - }, - }, - pointInTimeUTC: { - serializedName: "properties.pointInTimeUTC", - type: { - name: "DateTime", - }, - }, - availabilityZone: { - defaultValue: "", - serializedName: "properties.availabilityZone", - type: { - name: "String", - }, - }, - replicationRole: { - serializedName: "properties.replicationRole", - type: { - name: "String", - }, - }, - replicaCapacity: { - serializedName: "properties.replicaCapacity", - readOnly: true, - type: { - name: "Number", - }, - }, - replica: { - serializedName: "properties.replica", - type: { - name: "Composite", - className: "Replica", - }, - }, - createMode: { - serializedName: "properties.createMode", - type: { - name: "String", - }, - }, - privateEndpointConnections: { - serializedName: "properties.privateEndpointConnections", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PrivateEndpointConnection", - }, - }, - }, - }, - cluster: { - serializedName: "properties.cluster", - type: { - name: "Composite", - className: "Cluster", - }, - }, - }, - }, -}; - -export const AdministratorsMicrosoftEntraCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AdministratorsMicrosoftEntraCreateOrUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AdministratorsMicrosoftEntraDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AdministratorsMicrosoftEntraDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServerThreatProtectionSettingsCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServerThreatProtectionSettingsCreateOrUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const BackupsAutomaticAndOnDemandCreateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupsAutomaticAndOnDemandCreateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const BackupsAutomaticAndOnDemandDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupsAutomaticAndOnDemandDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ConfigurationsUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ConfigurationsUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ConfigurationsPutHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ConfigurationsPutHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DatabasesCreateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatabasesCreateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DatabasesDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DatabasesDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const FirewallRulesCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FirewallRulesCreateOrUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const FirewallRulesDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FirewallRulesDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const BackupsLongTermRetentionCheckPrerequisitesHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupsLongTermRetentionCheckPrerequisitesHeaders", - modelProperties: { - xMsRequestId: { - serializedName: "x-ms-request-id", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const BackupsLongTermRetentionCheckPrerequisitesExceptionHeaders: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "BackupsLongTermRetentionCheckPrerequisitesExceptionHeaders", - modelProperties: { - xMsErrorCode: { - serializedName: "x-ms-error-code", - type: { - name: "String", - }, - }, - xMsRequestId: { - serializedName: "x-ms-request-id", - type: { - name: "String", - }, - }, - }, - }, - }; - -export const BackupsLongTermRetentionStartHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupsLongTermRetentionStartHeaders", - modelProperties: { - xMsRequestId: { - serializedName: "x-ms-request-id", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const BackupsLongTermRetentionStartExceptionHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "BackupsLongTermRetentionStartExceptionHeaders", - modelProperties: { - xMsErrorCode: { - serializedName: "x-ms-error-code", - type: { - name: "String", - }, - }, - xMsRequestId: { - serializedName: "x-ms-request-id", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionsUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnectionsUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionsDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnectionsDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServersCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServersCreateOrUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServersUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServersUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServersDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServersDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServersRestartHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServersRestartHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServersStartHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServersStartHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ServersStopHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ServersStopHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const VirtualEndpointsCreateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "VirtualEndpointsCreateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const VirtualEndpointsUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "VirtualEndpointsUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const VirtualEndpointsDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "VirtualEndpointsDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String", - }, - }, - }, - }, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/models/models.ts b/sdk/postgresql/arm-postgresql-flexible/src/models/models.ts new file mode 100644 index 000000000000..43f0f97bf5b8 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/models/models.ts @@ -0,0 +1,5969 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { areAllPropsUndefined } from "../static-helpers/serialization/check-prop-undefined.js"; + +/** + * 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 */ +/** Paged collection of Operation items */ +export interface _OperationList { + /** The Operation items on this page */ + value: Operation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _operationListDeserializer(item: any): _OperationList { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** REST API operation definition. */ +export interface Operation { + /** Name of the operation being performed on this particular object. */ + readonly name?: string; + /** Localized display information for this particular operation or action. */ + readonly display?: OperationDisplay; + /** Indicates if the operation is a data action. */ + isDataAction?: boolean; + /** Intended executor of the operation. */ + readonly origin?: OperationOrigin; + /** Additional descriptions for the operation. */ + readonly properties?: OperationProperties; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + isDataAction: item["isDataAction"], + origin: item["origin"], + properties: !item["properties"] + ? item["properties"] + : operationPropertiesDeserializer(item["properties"]), + }; +} + +/** Display metadata associated with the operation. */ +export interface OperationDisplay { + /** Name of the resource provider. */ + readonly provider?: string; + /** Type of resource on which the operation is performed. */ + readonly resource?: string; + /** Name of the operation. */ + readonly operation?: string; + /** Description of the operation. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** Intended executor of the operation. */ +export enum KnownOperationOrigin { + /** NotSpecified */ + NotSpecified = "NotSpecified", + /** user */ + User = "user", + /** system */ + System = "system", +} + +/** + * Intended executor of the operation. \ + * {@link KnownOperationOrigin} can be used interchangeably with OperationOrigin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotSpecified** \ + * **user** \ + * **system** + */ +export type OperationOrigin = string; + +/** Additional properties for operation metadata. */ +export interface OperationProperties { + /** Service specification for the operation. */ + serviceSpecification?: ServiceSpecification; +} + +export function operationPropertiesDeserializer(item: any): OperationProperties { + return { + serviceSpecification: !item["serviceSpecification"] + ? item["serviceSpecification"] + : serviceSpecificationDeserializer(item["serviceSpecification"]), + }; +} + +/** Service specification for an operation. */ +export interface ServiceSpecification { + /** Metric specifications for the operation. */ + readonly metricSpecifications?: MetricSpecification[]; + /** Log specifications for the operation. */ + readonly logSpecifications?: LogSpecification[]; +} + +export function serviceSpecificationDeserializer(item: any): ServiceSpecification { + return { + metricSpecifications: !item["metricSpecifications"] + ? item["metricSpecifications"] + : metricSpecificationArrayDeserializer(item["metricSpecifications"]), + logSpecifications: !item["logSpecifications"] + ? item["logSpecifications"] + : logSpecificationArrayDeserializer(item["logSpecifications"]), + }; +} + +export function metricSpecificationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return metricSpecificationDeserializer(item); + }); +} + +/** Metric specification for an operation. */ +export interface MetricSpecification { + /** Name of the metric. */ + name?: string; + /** Display name of the metric. */ + displayName?: string; + /** Display description of the metric. */ + displayDescription?: string; + /** Unit of the metric. */ + unit?: string; + /** Aggregation type of the metric. */ + aggregationType?: string; + /** Supported aggregation types for the metric. */ + supportedAggregationTypes?: string[]; + /** Supported time grain types for the metric. */ + supportedTimeGrainTypes?: string[]; + /** Category of the metric. */ + category?: string; +} + +export function metricSpecificationDeserializer(item: any): MetricSpecification { + return { + name: item["name"], + displayName: item["displayName"], + displayDescription: item["displayDescription"], + unit: item["unit"], + aggregationType: item["aggregationType"], + supportedAggregationTypes: !item["supportedAggregationTypes"] + ? item["supportedAggregationTypes"] + : item["supportedAggregationTypes"].map((p: any) => { + return p; + }), + supportedTimeGrainTypes: !item["supportedTimeGrainTypes"] + ? item["supportedTimeGrainTypes"] + : item["supportedTimeGrainTypes"].map((p: any) => { + return p; + }), + category: item["category"], + }; +} + +export function logSpecificationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return logSpecificationDeserializer(item); + }); +} + +/** Log specification for an operation. */ +export interface LogSpecification { + /** Name of the log. */ + name?: string; + /** Display name of the log. */ + displayName?: string; + /** Blob duration for the log. */ + blobDuration?: string; +} + +export function logSpecificationDeserializer(item: any): LogSpecification { + return { + name: item["name"], + displayName: item["displayName"], + blobDuration: item["blobDuration"], + }; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + }; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] ? item["details"] : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: any; +} + +export function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo { + return { + type: item["type"], + info: item["info"], + }; +} + +/** Properties of a migration. */ +export interface Migration extends TrackedResource { + /** Identifier of a migration. */ + readonly migrationId?: string; + /** Current status of a migration. */ + readonly currentStatus?: MigrationStatus; + /** Identifier of the private endpoint migration instance. */ + migrationInstanceResourceId?: string; + /** Mode used to perform the migration: Online or Offline. */ + migrationMode?: MigrationMode; + /** Supported option for a migration. */ + migrationOption?: MigrationOption; + /** Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL */ + sourceType?: SourceType; + /** SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is 'VerifyFull'. Default SSL mode for other source types is 'Prefer'. */ + sslMode?: SslMode; + /** Metadata of source database server. */ + readonly sourceDbServerMetadata?: DbServerMetadata; + /** Metadata of target database server. */ + readonly targetDbServerMetadata?: DbServerMetadata; + /** Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username. */ + sourceDbServerResourceId?: string; + /** Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server. */ + sourceDbServerFullyQualifiedDomainName?: string; + /** Identifier of the target database server resource. */ + readonly targetDbServerResourceId?: string; + /** Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server. */ + targetDbServerFullyQualifiedDomainName?: string; + /** Migration secret parameters. */ + secretParameters?: MigrationSecretParameters; + /** Names of databases to migrate. */ + dbsToMigrate?: string[]; + /** Indicates whether to setup logical replication on source server, if needed. */ + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + /** Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation. */ + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + /** Start time (UTC) for migration window. */ + migrationWindowStartTimeInUtc?: Date; + /** End time (UTC) for migration window. */ + migrationWindowEndTimeInUtc?: Date; + /** Indicates if roles and permissions must be migrated. */ + migrateRoles?: MigrateRolesAndPermissions; + /** Indicates if data migration must start right away. */ + startDataMigration?: StartDataMigration; + /** Indicates if cutover must be triggered for the entire migration. */ + triggerCutover?: TriggerCutover; + /** When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ + dbsToTriggerCutoverOn?: string[]; + /** Indicates if cancel must be triggered for the entire migration. */ + cancel?: Cancel; + /** When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ + dbsToCancelMigrationOn?: string[]; +} + +export function migrationSerializer(item: Migration): any { + return { + tags: item["tags"], + location: item["location"], + properties: areAllPropsUndefined(item, [ + "migrationInstanceResourceId", + "migrationMode", + "migrationOption", + "sourceType", + "sslMode", + "sourceDbServerResourceId", + "sourceDbServerFullyQualifiedDomainName", + "targetDbServerFullyQualifiedDomainName", + "secretParameters", + "dbsToMigrate", + "setupLogicalReplicationOnSourceDbIfNeeded", + "overwriteDbsInTarget", + "migrationWindowStartTimeInUtc", + "migrationWindowEndTimeInUtc", + "migrateRoles", + "startDataMigration", + "triggerCutover", + "dbsToTriggerCutoverOn", + "cancel", + "dbsToCancelMigrationOn", + ]) + ? undefined + : _migrationPropertiesSerializer(item), + }; +} + +export function migrationDeserializer(item: any): Migration { + return { + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _migrationPropertiesDeserializer(item["properties"])), + }; +} + +/** Migration. */ +export interface MigrationProperties { + /** Identifier of a migration. */ + readonly migrationId?: string; + /** Current status of a migration. */ + readonly currentStatus?: MigrationStatus; + /** Identifier of the private endpoint migration instance. */ + migrationInstanceResourceId?: string; + /** Mode used to perform the migration: Online or Offline. */ + migrationMode?: MigrationMode; + /** Supported option for a migration. */ + migrationOption?: MigrationOption; + /** Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL */ + sourceType?: SourceType; + /** SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is 'VerifyFull'. Default SSL mode for other source types is 'Prefer'. */ + sslMode?: SslMode; + /** Metadata of source database server. */ + readonly sourceDbServerMetadata?: DbServerMetadata; + /** Metadata of target database server. */ + readonly targetDbServerMetadata?: DbServerMetadata; + /** Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username. */ + sourceDbServerResourceId?: string; + /** Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server. */ + sourceDbServerFullyQualifiedDomainName?: string; + /** Identifier of the target database server resource. */ + readonly targetDbServerResourceId?: string; + /** Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server. */ + targetDbServerFullyQualifiedDomainName?: string; + /** Migration secret parameters. */ + secretParameters?: MigrationSecretParameters; + /** Names of databases to migrate. */ + dbsToMigrate?: string[]; + /** Indicates whether to setup logical replication on source server, if needed. */ + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + /** Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation. */ + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + /** Start time (UTC) for migration window. */ + migrationWindowStartTimeInUtc?: Date; + /** End time (UTC) for migration window. */ + migrationWindowEndTimeInUtc?: Date; + /** Indicates if roles and permissions must be migrated. */ + migrateRoles?: MigrateRolesAndPermissions; + /** Indicates if data migration must start right away. */ + startDataMigration?: StartDataMigration; + /** Indicates if cutover must be triggered for the entire migration. */ + triggerCutover?: TriggerCutover; + /** When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ + dbsToTriggerCutoverOn?: string[]; + /** Indicates if cancel must be triggered for the entire migration. */ + cancel?: Cancel; + /** When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ + dbsToCancelMigrationOn?: string[]; +} + +export function migrationPropertiesSerializer(item: MigrationProperties): any { + return { + migrationInstanceResourceId: item["migrationInstanceResourceId"], + migrationMode: item["migrationMode"], + migrationOption: item["migrationOption"], + sourceType: item["sourceType"], + sslMode: item["sslMode"], + sourceDbServerResourceId: item["sourceDbServerResourceId"], + sourceDbServerFullyQualifiedDomainName: item["sourceDbServerFullyQualifiedDomainName"], + targetDbServerFullyQualifiedDomainName: item["targetDbServerFullyQualifiedDomainName"], + secretParameters: !item["secretParameters"] + ? item["secretParameters"] + : migrationSecretParametersSerializer(item["secretParameters"]), + dbsToMigrate: !item["dbsToMigrate"] + ? item["dbsToMigrate"] + : item["dbsToMigrate"].map((p: any) => { + return p; + }), + setupLogicalReplicationOnSourceDbIfNeeded: item["setupLogicalReplicationOnSourceDbIfNeeded"], + overwriteDbsInTarget: item["overwriteDbsInTarget"], + migrationWindowStartTimeInUtc: !item["migrationWindowStartTimeInUtc"] + ? item["migrationWindowStartTimeInUtc"] + : item["migrationWindowStartTimeInUtc"].toISOString(), + migrationWindowEndTimeInUtc: !item["migrationWindowEndTimeInUtc"] + ? item["migrationWindowEndTimeInUtc"] + : item["migrationWindowEndTimeInUtc"].toISOString(), + migrateRoles: item["migrateRoles"], + startDataMigration: item["startDataMigration"], + triggerCutover: item["triggerCutover"], + dbsToTriggerCutoverOn: !item["dbsToTriggerCutoverOn"] + ? item["dbsToTriggerCutoverOn"] + : item["dbsToTriggerCutoverOn"].map((p: any) => { + return p; + }), + cancel: item["cancel"], + dbsToCancelMigrationOn: !item["dbsToCancelMigrationOn"] + ? item["dbsToCancelMigrationOn"] + : item["dbsToCancelMigrationOn"].map((p: any) => { + return p; + }), + }; +} + +export function migrationPropertiesDeserializer(item: any): MigrationProperties { + return { + migrationId: item["migrationId"], + currentStatus: !item["currentStatus"] + ? item["currentStatus"] + : migrationStatusDeserializer(item["currentStatus"]), + migrationInstanceResourceId: item["migrationInstanceResourceId"], + migrationMode: item["migrationMode"], + migrationOption: item["migrationOption"], + sourceType: item["sourceType"], + sslMode: item["sslMode"], + sourceDbServerMetadata: !item["sourceDbServerMetadata"] + ? item["sourceDbServerMetadata"] + : dbServerMetadataDeserializer(item["sourceDbServerMetadata"]), + targetDbServerMetadata: !item["targetDbServerMetadata"] + ? item["targetDbServerMetadata"] + : dbServerMetadataDeserializer(item["targetDbServerMetadata"]), + sourceDbServerResourceId: item["sourceDbServerResourceId"], + sourceDbServerFullyQualifiedDomainName: item["sourceDbServerFullyQualifiedDomainName"], + targetDbServerResourceId: item["targetDbServerResourceId"], + targetDbServerFullyQualifiedDomainName: item["targetDbServerFullyQualifiedDomainName"], + secretParameters: !item["secretParameters"] + ? item["secretParameters"] + : migrationSecretParametersDeserializer(item["secretParameters"]), + dbsToMigrate: !item["dbsToMigrate"] + ? item["dbsToMigrate"] + : item["dbsToMigrate"].map((p: any) => { + return p; + }), + setupLogicalReplicationOnSourceDbIfNeeded: item["setupLogicalReplicationOnSourceDbIfNeeded"], + overwriteDbsInTarget: item["overwriteDbsInTarget"], + migrationWindowStartTimeInUtc: !item["migrationWindowStartTimeInUtc"] + ? item["migrationWindowStartTimeInUtc"] + : new Date(item["migrationWindowStartTimeInUtc"]), + migrationWindowEndTimeInUtc: !item["migrationWindowEndTimeInUtc"] + ? item["migrationWindowEndTimeInUtc"] + : new Date(item["migrationWindowEndTimeInUtc"]), + migrateRoles: item["migrateRoles"], + startDataMigration: item["startDataMigration"], + triggerCutover: item["triggerCutover"], + dbsToTriggerCutoverOn: !item["dbsToTriggerCutoverOn"] + ? item["dbsToTriggerCutoverOn"] + : item["dbsToTriggerCutoverOn"].map((p: any) => { + return p; + }), + cancel: item["cancel"], + dbsToCancelMigrationOn: !item["dbsToCancelMigrationOn"] + ? item["dbsToCancelMigrationOn"] + : item["dbsToCancelMigrationOn"].map((p: any) => { + return p; + }), + }; +} + +/** State of migration. */ +export interface MigrationStatus { + /** State of migration. */ + readonly state?: MigrationState; + /** Error message, if any, for the migration state. */ + readonly error?: string; + /** Current migration sub state details. */ + readonly currentSubStateDetails?: MigrationSubstateDetails; +} + +export function migrationStatusDeserializer(item: any): MigrationStatus { + return { + state: item["state"], + error: item["error"], + currentSubStateDetails: !item["currentSubStateDetails"] + ? item["currentSubStateDetails"] + : migrationSubstateDetailsDeserializer(item["currentSubStateDetails"]), + }; +} + +/** State of migration. */ +export enum KnownMigrationState { + /** InProgress */ + InProgress = "InProgress", + /** WaitingForUserAction */ + WaitingForUserAction = "WaitingForUserAction", + /** Canceled */ + Canceled = "Canceled", + /** Failed */ + Failed = "Failed", + /** Succeeded */ + Succeeded = "Succeeded", + /** ValidationFailed */ + ValidationFailed = "ValidationFailed", + /** CleaningUp */ + CleaningUp = "CleaningUp", +} + +/** + * State of migration. \ + * {@link KnownMigrationState} can be used interchangeably with MigrationState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InProgress** \ + * **WaitingForUserAction** \ + * **Canceled** \ + * **Failed** \ + * **Succeeded** \ + * **ValidationFailed** \ + * **CleaningUp** + */ +export type MigrationState = string; + +/** Details of migration substate. */ +export interface MigrationSubstateDetails { + /** Substate of migration. */ + readonly currentSubState?: MigrationSubstate; + dbDetails?: Record; + validationDetails?: ValidationDetails; +} + +export function migrationSubstateDetailsDeserializer(item: any): MigrationSubstateDetails { + return { + currentSubState: item["currentSubState"], + dbDetails: !item["dbDetails"] + ? item["dbDetails"] + : databaseMigrationStateRecordDeserializer(item["dbDetails"]), + validationDetails: !item["validationDetails"] + ? item["validationDetails"] + : validationDetailsDeserializer(item["validationDetails"]), + }; +} + +/** Substate of migration. */ +export enum KnownMigrationSubstate { + /** PerformingPreRequisiteSteps */ + PerformingPreRequisiteSteps = "PerformingPreRequisiteSteps", + /** WaitingForLogicalReplicationSetupRequestOnSourceDB */ + WaitingForLogicalReplicationSetupRequestOnSourceDB = "WaitingForLogicalReplicationSetupRequestOnSourceDB", + /** WaitingForDBsToMigrateSpecification */ + WaitingForDBsToMigrateSpecification = "WaitingForDBsToMigrateSpecification", + /** WaitingForTargetDBOverwriteConfirmation */ + WaitingForTargetDBOverwriteConfirmation = "WaitingForTargetDBOverwriteConfirmation", + /** WaitingForDataMigrationScheduling */ + WaitingForDataMigrationScheduling = "WaitingForDataMigrationScheduling", + /** WaitingForDataMigrationWindow */ + WaitingForDataMigrationWindow = "WaitingForDataMigrationWindow", + /** MigratingData */ + MigratingData = "MigratingData", + /** WaitingForCutoverTrigger */ + WaitingForCutoverTrigger = "WaitingForCutoverTrigger", + /** CompletingMigration */ + CompletingMigration = "CompletingMigration", + /** Completed */ + Completed = "Completed", + /** CancelingRequestedDBMigrations */ + CancelingRequestedDBMigrations = "CancelingRequestedDBMigrations", + /** ValidationInProgress */ + ValidationInProgress = "ValidationInProgress", +} + +/** + * Substate of migration. \ + * {@link KnownMigrationSubstate} can be used interchangeably with MigrationSubstate, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **PerformingPreRequisiteSteps** \ + * **WaitingForLogicalReplicationSetupRequestOnSourceDB** \ + * **WaitingForDBsToMigrateSpecification** \ + * **WaitingForTargetDBOverwriteConfirmation** \ + * **WaitingForDataMigrationScheduling** \ + * **WaitingForDataMigrationWindow** \ + * **MigratingData** \ + * **WaitingForCutoverTrigger** \ + * **CompletingMigration** \ + * **Completed** \ + * **CancelingRequestedDBMigrations** \ + * **ValidationInProgress** + */ +export type MigrationSubstate = string; + +export function databaseMigrationStateRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : databaseMigrationStateDeserializer(item[key]); + }); + return result; +} + +/** Migration state of a database. */ +export interface DatabaseMigrationState { + /** Name of database. */ + databaseName?: string; + /** Migration state of a database. */ + migrationState?: MigrationDatabaseState; + /** Migration operation of a database. */ + migrationOperation?: string; + /** Start time of a migration state. */ + startedOn?: Date; + /** End time of a migration state. */ + endedOn?: Date; + /** Number of tables queued for the migration of a database. */ + fullLoadQueuedTables?: number; + /** Number of tables encountering errors during the migration of a database. */ + fullLoadErroredTables?: number; + /** Number of tables loading during the migration of a database. */ + fullLoadLoadingTables?: number; + /** Number of tables loaded during the migration of a database. */ + fullLoadCompletedTables?: number; + /** Change Data Capture update counter. */ + cdcUpdateCounter?: number; + /** Change Data Capture delete counter. */ + cdcDeleteCounter?: number; + /** Change Data Capture insert counter. */ + cdcInsertCounter?: number; + /** Change Data Capture applied changes counter. */ + appliedChanges?: number; + /** Change Data Capture incoming changes counter. */ + incomingChanges?: number; + /** Lag in seconds between source and target during online phase. */ + latency?: number; + /** Error message, if any, for the migration state. */ + message?: string; +} + +export function databaseMigrationStateDeserializer(item: any): DatabaseMigrationState { + return { + databaseName: item["databaseName"], + migrationState: item["migrationState"], + migrationOperation: item["migrationOperation"], + startedOn: !item["startedOn"] ? item["startedOn"] : new Date(item["startedOn"]), + endedOn: !item["endedOn"] ? item["endedOn"] : new Date(item["endedOn"]), + fullLoadQueuedTables: item["fullLoadQueuedTables"], + fullLoadErroredTables: item["fullLoadErroredTables"], + fullLoadLoadingTables: item["fullLoadLoadingTables"], + fullLoadCompletedTables: item["fullLoadCompletedTables"], + cdcUpdateCounter: item["cdcUpdateCounter"], + cdcDeleteCounter: item["cdcDeleteCounter"], + cdcInsertCounter: item["cdcInsertCounter"], + appliedChanges: item["appliedChanges"], + incomingChanges: item["incomingChanges"], + latency: item["latency"], + message: item["message"], + }; +} + +/** Migration state of a database. */ +export enum KnownMigrationDatabaseState { + /** InProgress */ + InProgress = "InProgress", + /** WaitingForCutoverTrigger */ + WaitingForCutoverTrigger = "WaitingForCutoverTrigger", + /** Failed */ + Failed = "Failed", + /** Canceled */ + Canceled = "Canceled", + /** Succeeded */ + Succeeded = "Succeeded", + /** Canceling */ + Canceling = "Canceling", +} + +/** + * Migration state of a database. \ + * {@link KnownMigrationDatabaseState} can be used interchangeably with MigrationDatabaseState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InProgress** \ + * **WaitingForCutoverTrigger** \ + * **Failed** \ + * **Canceled** \ + * **Succeeded** \ + * **Canceling** + */ +export type MigrationDatabaseState = string; + +/** Details for the validation for migration. */ +export interface ValidationDetails { + /** Validation status for migration. */ + status?: ValidationState; + /** Start time (UTC) for validation. */ + validationStartTimeInUtc?: Date; + /** End time (UTC) for validation. */ + validationEndTimeInUtc?: Date; + /** Details of server level validations. */ + serverLevelValidationDetails?: ValidationSummaryItem[]; + /** Details of server level validations. */ + dbLevelValidationDetails?: DbLevelValidationStatus[]; +} + +export function validationDetailsDeserializer(item: any): ValidationDetails { + return { + status: item["status"], + validationStartTimeInUtc: !item["validationStartTimeInUtc"] + ? item["validationStartTimeInUtc"] + : new Date(item["validationStartTimeInUtc"]), + validationEndTimeInUtc: !item["validationEndTimeInUtc"] + ? item["validationEndTimeInUtc"] + : new Date(item["validationEndTimeInUtc"]), + serverLevelValidationDetails: !item["serverLevelValidationDetails"] + ? item["serverLevelValidationDetails"] + : validationSummaryItemArrayDeserializer(item["serverLevelValidationDetails"]), + dbLevelValidationDetails: !item["dbLevelValidationDetails"] + ? item["dbLevelValidationDetails"] + : dbLevelValidationStatusArrayDeserializer(item["dbLevelValidationDetails"]), + }; +} + +/** Validation status for migration. */ +export enum KnownValidationState { + /** Failed */ + Failed = "Failed", + /** Succeeded */ + Succeeded = "Succeeded", + /** Warning */ + Warning = "Warning", +} + +/** + * Validation status for migration. \ + * {@link KnownValidationState} can be used interchangeably with ValidationState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Failed** \ + * **Succeeded** \ + * **Warning** + */ +export type ValidationState = string; + +export function validationSummaryItemArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return validationSummaryItemDeserializer(item); + }); +} + +/** Validation summary object. */ +export interface ValidationSummaryItem { + /** Validation type. */ + type?: string; + /** Validation status for migration. */ + state?: ValidationState; + /** Validation messages. */ + messages?: ValidationMessage[]; +} + +export function validationSummaryItemDeserializer(item: any): ValidationSummaryItem { + return { + type: item["type"], + state: item["state"], + messages: !item["messages"] + ? item["messages"] + : validationMessageArrayDeserializer(item["messages"]), + }; +} + +export function validationMessageArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return validationMessageDeserializer(item); + }); +} + +/** Validation message object. */ +export interface ValidationMessage { + /** Severity of validation message. */ + state?: ValidationState; + /** Validation message string. */ + message?: string; +} + +export function validationMessageDeserializer(item: any): ValidationMessage { + return { + state: item["state"], + message: item["message"], + }; +} + +export function dbLevelValidationStatusArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return dbLevelValidationStatusDeserializer(item); + }); +} + +/** Validation status summary for a database. */ +export interface DbLevelValidationStatus { + /** Name of database. */ + databaseName?: string; + /** Start time of a database level validation. */ + startedOn?: Date; + /** End time of a database level validation. */ + endedOn?: Date; + /** Summary of database level validations. */ + summary?: ValidationSummaryItem[]; +} + +export function dbLevelValidationStatusDeserializer(item: any): DbLevelValidationStatus { + return { + databaseName: item["databaseName"], + startedOn: !item["startedOn"] ? item["startedOn"] : new Date(item["startedOn"]), + endedOn: !item["endedOn"] ? item["endedOn"] : new Date(item["endedOn"]), + summary: !item["summary"] + ? item["summary"] + : validationSummaryItemArrayDeserializer(item["summary"]), + }; +} + +/** Mode used to perform the migration: Online or Offline. */ +export enum KnownMigrationMode { + /** Offline */ + Offline = "Offline", + /** Online */ + Online = "Online", +} + +/** + * Mode used to perform the migration: Online or Offline. \ + * {@link KnownMigrationMode} can be used interchangeably with MigrationMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Offline** \ + * **Online** + */ +export type MigrationMode = string; + +/** Supported option for a migration */ +export enum KnownMigrationOption { + /** Validate */ + Validate = "Validate", + /** Migrate */ + Migrate = "Migrate", + /** ValidateAndMigrate */ + ValidateAndMigrate = "ValidateAndMigrate", +} + +/** + * Supported option for a migration \ + * {@link KnownMigrationOption} can be used interchangeably with MigrationOption, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Validate** \ + * **Migrate** \ + * **ValidateAndMigrate** + */ +export type MigrationOption = string; + +/** Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL */ +export enum KnownSourceType { + /** OnPremises */ + OnPremises = "OnPremises", + /** AWS */ + AWS = "AWS", + /** GCP */ + GCP = "GCP", + /** AzureVM */ + AzureVM = "AzureVM", + /** PostgreSQLSingleServer */ + PostgreSQLSingleServer = "PostgreSQLSingleServer", + /** AWS_RDS */ + AWSRDS = "AWS_RDS", + /** AWS_AURORA */ + AWSAurora = "AWS_AURORA", + /** AWS_EC2 */ + AWSEC2 = "AWS_EC2", + /** GCP_CloudSQL */ + GCPCloudSQL = "GCP_CloudSQL", + /** GCP_AlloyDB */ + GCPAlloyDB = "GCP_AlloyDB", + /** GCP_Compute */ + GCPCompute = "GCP_Compute", + /** EDB */ + EDB = "EDB", + /** EDB_Oracle_Server */ + EDBOracleServer = "EDB_Oracle_Server", + /** EDB_PostgreSQL */ + EDBPostgreSQL = "EDB_PostgreSQL", + /** PostgreSQLFlexibleServer */ + PostgreSQLFlexibleServer = "PostgreSQLFlexibleServer", + /** PostgreSQLCosmosDB */ + PostgreSQLCosmosDB = "PostgreSQLCosmosDB", + /** Huawei_RDS */ + HuaweiRDS = "Huawei_RDS", + /** Huawei_Compute */ + HuaweiCompute = "Huawei_Compute", + /** Heroku_PostgreSQL */ + HerokuPostgreSQL = "Heroku_PostgreSQL", + /** Crunchy_PostgreSQL */ + CrunchyPostgreSQL = "Crunchy_PostgreSQL", + /** ApsaraDB_RDS */ + ApsaraDBRDS = "ApsaraDB_RDS", + /** Digital_Ocean_Droplets */ + DigitalOceanDroplets = "Digital_Ocean_Droplets", + /** Digital_Ocean_PostgreSQL */ + DigitalOceanPostgreSQL = "Digital_Ocean_PostgreSQL", + /** Supabase_PostgreSQL */ + SupabasePostgreSQL = "Supabase_PostgreSQL", +} + +/** + * Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL \ + * {@link KnownSourceType} can be used interchangeably with SourceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **OnPremises** \ + * **AWS** \ + * **GCP** \ + * **AzureVM** \ + * **PostgreSQLSingleServer** \ + * **AWS_RDS** \ + * **AWS_AURORA** \ + * **AWS_EC2** \ + * **GCP_CloudSQL** \ + * **GCP_AlloyDB** \ + * **GCP_Compute** \ + * **EDB** \ + * **EDB_Oracle_Server** \ + * **EDB_PostgreSQL** \ + * **PostgreSQLFlexibleServer** \ + * **PostgreSQLCosmosDB** \ + * **Huawei_RDS** \ + * **Huawei_Compute** \ + * **Heroku_PostgreSQL** \ + * **Crunchy_PostgreSQL** \ + * **ApsaraDB_RDS** \ + * **Digital_Ocean_Droplets** \ + * **Digital_Ocean_PostgreSQL** \ + * **Supabase_PostgreSQL** + */ +export type SourceType = string; + +/** SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is 'VerifyFull'. Default SSL mode for other source types is 'Prefer'. */ +export enum KnownSslMode { + /** Prefer */ + Prefer = "Prefer", + /** Require */ + Require = "Require", + /** VerifyCA */ + VerifyCA = "VerifyCA", + /** VerifyFull */ + VerifyFull = "VerifyFull", +} + +/** + * SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is 'VerifyFull'. Default SSL mode for other source types is 'Prefer'. \ + * {@link KnownSslMode} can be used interchangeably with SslMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Prefer** \ + * **Require** \ + * **VerifyCA** \ + * **VerifyFull** + */ +export type SslMode = string; + +/** Database server metadata. */ +export interface DbServerMetadata { + /** Location of database server. */ + readonly location?: string; + /** Major version of PostgreSQL database engine. */ + version?: string; + /** Storage size (in MB) for database server. */ + storageMb?: number; + /** Compute tier and size of the database server. This object is empty for an Azure Database for PostgreSQL single server. */ + sku?: ServerSku; +} + +export function dbServerMetadataDeserializer(item: any): DbServerMetadata { + return { + location: item["location"], + version: item["version"], + storageMb: item["storageMb"], + sku: !item["sku"] ? item["sku"] : serverSkuDeserializer(item["sku"]), + }; +} + +/** Compute information of a server. */ +export interface ServerSku { + /** Compute tier and size of the database server. This object is empty for an Azure Database for PostgreSQL single server. */ + name?: string; + /** Tier of the compute assigned to a server. */ + tier?: SkuTier; +} + +export function serverSkuDeserializer(item: any): ServerSku { + return { + name: item["name"], + tier: item["tier"], + }; +} + +/** Tier of the compute assigned to a server. */ +export enum KnownSkuTier { + /** Burstable */ + Burstable = "Burstable", + /** GeneralPurpose */ + GeneralPurpose = "GeneralPurpose", + /** MemoryOptimized */ + MemoryOptimized = "MemoryOptimized", +} + +/** + * Tier of the compute assigned to a server. \ + * {@link KnownSkuTier} can be used interchangeably with SkuTier, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Burstable** \ + * **GeneralPurpose** \ + * **MemoryOptimized** + */ +export type SkuTier = string; + +/** Migration secret parameters. */ +export interface MigrationSecretParameters { + /** Credentials of administrator users for source and target servers. */ + adminCredentials: AdminCredentials; + /** Gets or sets the name of the user for the source server. This user doesn't need to be an administrator. */ + sourceServerUsername?: string; + /** Gets or sets the name of the user for the target server. This user doesn't need to be an administrator. */ + targetServerUsername?: string; +} + +export function migrationSecretParametersSerializer(item: MigrationSecretParameters): any { + return { + adminCredentials: adminCredentialsSerializer(item["adminCredentials"]), + sourceServerUsername: item["sourceServerUsername"], + targetServerUsername: item["targetServerUsername"], + }; +} + +export function migrationSecretParametersDeserializer(item: any): MigrationSecretParameters { + return { + adminCredentials: adminCredentialsDeserializer(item["adminCredentials"]), + sourceServerUsername: item["sourceServerUsername"], + targetServerUsername: item["targetServerUsername"], + }; +} + +/** Credentials of administrator users for source and target servers. */ +export interface AdminCredentials { + /** Password for the user of the source server. */ + sourceServerPassword: string; + /** Password for the user of the target server. */ + targetServerPassword: string; +} + +export function adminCredentialsSerializer(item: AdminCredentials): any { + return { + sourceServerPassword: item["sourceServerPassword"], + targetServerPassword: item["targetServerPassword"], + }; +} + +export function adminCredentialsDeserializer(item: any): AdminCredentials { + return { + sourceServerPassword: item["sourceServerPassword"], + targetServerPassword: item["targetServerPassword"], + }; +} + +/** Indicates whether to setup logical replication on source server, if needed. */ +export enum KnownLogicalReplicationOnSourceServer { + /** True */ + True = "True", + /** False */ + False = "False", +} + +/** + * Indicates whether to setup logical replication on source server, if needed. \ + * {@link KnownLogicalReplicationOnSourceServer} can be used interchangeably with LogicalReplicationOnSourceServer, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **True** \ + * **False** + */ +export type LogicalReplicationOnSourceServer = string; + +/** Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation. */ +export enum KnownOverwriteDatabasesOnTargetServer { + /** True */ + True = "True", + /** False */ + False = "False", +} + +/** + * Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation. \ + * {@link KnownOverwriteDatabasesOnTargetServer} can be used interchangeably with OverwriteDatabasesOnTargetServer, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **True** \ + * **False** + */ +export type OverwriteDatabasesOnTargetServer = string; + +/** Indicates if roles and permissions must be migrated. */ +export enum KnownMigrateRolesAndPermissions { + /** True */ + True = "True", + /** False */ + False = "False", +} + +/** + * Indicates if roles and permissions must be migrated. \ + * {@link KnownMigrateRolesAndPermissions} can be used interchangeably with MigrateRolesAndPermissions, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **True** \ + * **False** + */ +export type MigrateRolesAndPermissions = string; + +/** Indicates if data migration must start right away. */ +export enum KnownStartDataMigration { + /** True */ + True = "True", + /** False */ + False = "False", +} + +/** + * Indicates if data migration must start right away. \ + * {@link KnownStartDataMigration} can be used interchangeably with StartDataMigration, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **True** \ + * **False** + */ +export type StartDataMigration = string; + +/** Indicates if cutover must be triggered for the entire migration. */ +export enum KnownTriggerCutover { + /** True */ + True = "True", + /** False */ + False = "False", +} + +/** + * Indicates if cutover must be triggered for the entire migration. \ + * {@link KnownTriggerCutover} can be used interchangeably with TriggerCutover, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **True** \ + * **False** + */ +export type TriggerCutover = string; + +/** Indicates if cancel must be triggered for the entire migration. */ +export enum KnownCancel { + /** True */ + True = "True", + /** False */ + False = "False", +} + +/** + * Indicates if cancel must be triggered for the entire migration. \ + * {@link KnownCancel} can be used interchangeably with Cancel, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **True** \ + * **False** + */ +export type Cancel = string; + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + location: item["location"], + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** Migration. */ +export interface MigrationResourceForPatch { + /** Application-specific metadata in the form of key-value pairs. */ + tags?: Record; + /** Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username. */ + sourceDbServerResourceId?: string; + /** Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server. */ + sourceDbServerFullyQualifiedDomainName?: string; + /** Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server. */ + targetDbServerFullyQualifiedDomainName?: string; + /** Migration secret parameters. */ + secretParameters?: MigrationSecretParametersForPatch; + /** Names of databases to migrate. */ + dbsToMigrate?: string[]; + /** Indicates whether to setup logical replication on source server, if needed. */ + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + /** Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation. */ + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + /** Start time (UTC) for migration window. */ + migrationWindowStartTimeInUtc?: Date; + /** Indicates if roles and permissions must be migrated. */ + migrateRoles?: MigrateRolesAndPermissions; + /** Indicates if data migration must start right away. */ + startDataMigration?: StartDataMigration; + /** Indicates if cutover must be triggered for the entire migration. */ + triggerCutover?: TriggerCutover; + /** When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ + dbsToTriggerCutoverOn?: string[]; + /** Indicates if cancel must be triggered for the entire migration. */ + cancel?: Cancel; + /** When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ + dbsToCancelMigrationOn?: string[]; + /** Mode used to perform the migration: Online or Offline. */ + migrationMode?: MigrationMode; +} + +export function migrationResourceForPatchSerializer(item: MigrationResourceForPatch): any { + return { + properties: areAllPropsUndefined(item, [ + "sourceDbServerResourceId", + "sourceDbServerFullyQualifiedDomainName", + "targetDbServerFullyQualifiedDomainName", + "secretParameters", + "dbsToMigrate", + "setupLogicalReplicationOnSourceDbIfNeeded", + "overwriteDbsInTarget", + "migrationWindowStartTimeInUtc", + "migrateRoles", + "startDataMigration", + "triggerCutover", + "dbsToTriggerCutoverOn", + "cancel", + "dbsToCancelMigrationOn", + "migrationMode", + ]) + ? undefined + : _migrationResourceForPatchPropertiesSerializer(item), + tags: item["tags"], + }; +} + +/** Migration properties. */ +export interface MigrationPropertiesForPatch { + /** Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username. */ + sourceDbServerResourceId?: string; + /** Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server. */ + sourceDbServerFullyQualifiedDomainName?: string; + /** Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server. */ + targetDbServerFullyQualifiedDomainName?: string; + /** Migration secret parameters. */ + secretParameters?: MigrationSecretParametersForPatch; + /** Names of databases to migrate. */ + dbsToMigrate?: string[]; + /** Indicates whether to setup logical replication on source server, if needed. */ + setupLogicalReplicationOnSourceDbIfNeeded?: LogicalReplicationOnSourceServer; + /** Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation. */ + overwriteDbsInTarget?: OverwriteDatabasesOnTargetServer; + /** Start time (UTC) for migration window. */ + migrationWindowStartTimeInUtc?: Date; + /** Indicates if roles and permissions must be migrated. */ + migrateRoles?: MigrateRolesAndPermissions; + /** Indicates if data migration must start right away. */ + startDataMigration?: StartDataMigration; + /** Indicates if cutover must be triggered for the entire migration. */ + triggerCutover?: TriggerCutover; + /** When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ + dbsToTriggerCutoverOn?: string[]; + /** Indicates if cancel must be triggered for the entire migration. */ + cancel?: Cancel; + /** When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array. */ + dbsToCancelMigrationOn?: string[]; + /** Mode used to perform the migration: Online or Offline. */ + migrationMode?: MigrationMode; +} + +export function migrationPropertiesForPatchSerializer(item: MigrationPropertiesForPatch): any { + return { + sourceDbServerResourceId: item["sourceDbServerResourceId"], + sourceDbServerFullyQualifiedDomainName: item["sourceDbServerFullyQualifiedDomainName"], + targetDbServerFullyQualifiedDomainName: item["targetDbServerFullyQualifiedDomainName"], + secretParameters: !item["secretParameters"] + ? item["secretParameters"] + : migrationSecretParametersForPatchSerializer(item["secretParameters"]), + dbsToMigrate: !item["dbsToMigrate"] + ? item["dbsToMigrate"] + : item["dbsToMigrate"].map((p: any) => { + return p; + }), + setupLogicalReplicationOnSourceDbIfNeeded: item["setupLogicalReplicationOnSourceDbIfNeeded"], + overwriteDbsInTarget: item["overwriteDbsInTarget"], + migrationWindowStartTimeInUtc: !item["migrationWindowStartTimeInUtc"] + ? item["migrationWindowStartTimeInUtc"] + : item["migrationWindowStartTimeInUtc"].toISOString(), + migrateRoles: item["migrateRoles"], + startDataMigration: item["startDataMigration"], + triggerCutover: item["triggerCutover"], + dbsToTriggerCutoverOn: !item["dbsToTriggerCutoverOn"] + ? item["dbsToTriggerCutoverOn"] + : item["dbsToTriggerCutoverOn"].map((p: any) => { + return p; + }), + cancel: item["cancel"], + dbsToCancelMigrationOn: !item["dbsToCancelMigrationOn"] + ? item["dbsToCancelMigrationOn"] + : item["dbsToCancelMigrationOn"].map((p: any) => { + return p; + }), + migrationMode: item["migrationMode"], + }; +} + +/** Migration secret parameters. */ +export interface MigrationSecretParametersForPatch { + /** Credentials of administrator users for source and target servers. */ + adminCredentials?: AdminCredentialsForPatch; + /** Gets or sets the name of the user for the source server. This user doesn't need to be an administrator. */ + sourceServerUsername?: string; + /** Gets or sets the name of the user for the target server. This user doesn't need to be an administrator. */ + targetServerUsername?: string; +} + +export function migrationSecretParametersForPatchSerializer( + item: MigrationSecretParametersForPatch, +): any { + return { + adminCredentials: !item["adminCredentials"] + ? item["adminCredentials"] + : adminCredentialsForPatchSerializer(item["adminCredentials"]), + sourceServerUsername: item["sourceServerUsername"], + targetServerUsername: item["targetServerUsername"], + }; +} + +/** Credentials of administrator users for source and target servers. */ +export interface AdminCredentialsForPatch { + /** Password for the user of the source server. */ + sourceServerPassword?: string; + /** Password for the user of the target server. */ + targetServerPassword?: string; +} + +export function adminCredentialsForPatchSerializer(item: AdminCredentialsForPatch): any { + return { + sourceServerPassword: item["sourceServerPassword"], + targetServerPassword: item["targetServerPassword"], + }; +} + +/** List of migrations. */ +export interface _MigrationList { + /** The Migration items on this page */ + readonly value: Migration[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _migrationListDeserializer(item: any): _MigrationList { + return { + value: migrationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function migrationArraySerializer(result: Array): any[] { + return result.map((item) => { + return migrationSerializer(item); + }); +} + +export function migrationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return migrationDeserializer(item); + }); +} + +/** Availability of a migration name. */ +export interface MigrationNameAvailability { + /** Name of the migration to check for validity and availability. */ + name: string; + /** Type of resource. */ + type: string; + /** Indicates if the migration name is available. */ + readonly nameAvailable?: boolean; + /** Migration name availability reason. */ + readonly reason?: MigrationNameAvailabilityReason; + /** Migration name availability message. */ + readonly message?: string; +} + +export function migrationNameAvailabilitySerializer(item: MigrationNameAvailability): any { + return { name: item["name"], type: item["type"] }; +} + +export function migrationNameAvailabilityDeserializer(item: any): MigrationNameAvailability { + return { + name: item["name"], + type: item["type"], + nameAvailable: item["nameAvailable"], + reason: item["reason"], + message: item["message"], + }; +} + +/** Migration name availability reason. */ +export enum KnownMigrationNameAvailabilityReason { + /** Invalid */ + Invalid = "Invalid", + /** AlreadyExists */ + AlreadyExists = "AlreadyExists", +} + +/** + * Migration name availability reason. \ + * {@link KnownMigrationNameAvailabilityReason} can be used interchangeably with MigrationNameAvailabilityReason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **AlreadyExists** + */ +export type MigrationNameAvailabilityReason = string; + +/** Properties of a server. */ +export interface Server extends TrackedResource { + /** Compute tier and size of a server. */ + sku?: Sku; + /** User assigned managed identities assigned to the server. */ + identity?: UserAssignedIdentity; + /** Name of the login designated as the first password based administrator assigned to your instance of PostgreSQL. Must be specified the first time that you enable password based authentication on a server. Once set to a given value, it cannot be changed for the rest of the life of a server. If you disable password based authentication on a server which had it enabled, this password based role isn't deleted. */ + administratorLogin?: string; + /** Password assigned to the administrator login. As long as password authentication is enabled, this password can be changed at any time. */ + administratorLoginPassword?: string; + /** Major version of PostgreSQL database engine. */ + version?: PostgresMajorVersion; + /** Minor version of PostgreSQL database engine. */ + readonly minorVersion?: string; + /** Possible states of a server. */ + readonly state?: ServerState; + /** Fully qualified domain name of a server. */ + readonly fullyQualifiedDomainName?: string; + /** Storage properties of a server. */ + storage?: Storage; + /** Authentication configuration properties of a server. */ + authConfig?: AuthConfig; + /** Data encryption properties of a server. */ + dataEncryption?: DataEncryption; + /** Backup properties of a server. */ + backup?: Backup; + /** Network properties of a server. Only required if you want your server to be integrated into a virtual network provided by customer. */ + network?: Network; + /** High availability properties of a server. */ + highAvailability?: HighAvailability; + /** Maintenance window properties of a server. */ + maintenanceWindow?: MaintenanceWindow; + /** Identifier of the server to be used as the source of the new server. Required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', 'Replica', or 'ReviveDropped'. This property is returned only when the target server is a read replica. */ + sourceServerResourceId?: string; + /** Creation time (in ISO8601 format) of the backup which you want to restore in the new server. It's required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', or 'ReviveDropped'. */ + pointInTimeUTC?: Date; + /** Availability zone of a server. */ + availabilityZone?: string; + /** Role of the server in a replication set. */ + replicationRole?: ReplicationRole; + /** Maximum number of read replicas allowed for a server. */ + readonly replicaCapacity?: number; + /** Read replica properties of a server. Required only in case that you want to promote a server. */ + replica?: Replica; + /** Creation mode of a new server. */ + createMode?: CreateMode; + /** List of private endpoint connections associated with the specified server. */ + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + /** Cluster properties of a server. */ + cluster?: Cluster; +} + +export function serverSerializer(item: Server): any { + return { + tags: item["tags"], + location: item["location"], + properties: areAllPropsUndefined(item, [ + "administratorLogin", + "administratorLoginPassword", + "version", + "storage", + "authConfig", + "dataEncryption", + "backup", + "network", + "highAvailability", + "maintenanceWindow", + "sourceServerResourceId", + "pointInTimeUTC", + "availabilityZone", + "replicationRole", + "replica", + "createMode", + "cluster", + ]) + ? undefined + : _serverPropertiesSerializer(item), + sku: !item["sku"] ? item["sku"] : skuSerializer(item["sku"]), + identity: !item["identity"] + ? item["identity"] + : userAssignedIdentitySerializer(item["identity"]), + }; +} + +export function serverDeserializer(item: any): Server { + return { + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _serverPropertiesDeserializer(item["properties"])), + sku: !item["sku"] ? item["sku"] : skuDeserializer(item["sku"]), + identity: !item["identity"] + ? item["identity"] + : userAssignedIdentityDeserializer(item["identity"]), + }; +} + +/** Properties of a server. */ +export interface ServerProperties { + /** Name of the login designated as the first password based administrator assigned to your instance of PostgreSQL. Must be specified the first time that you enable password based authentication on a server. Once set to a given value, it cannot be changed for the rest of the life of a server. If you disable password based authentication on a server which had it enabled, this password based role isn't deleted. */ + administratorLogin?: string; + /** Password assigned to the administrator login. As long as password authentication is enabled, this password can be changed at any time. */ + administratorLoginPassword?: string; + /** Major version of PostgreSQL database engine. */ + version?: PostgresMajorVersion; + /** Minor version of PostgreSQL database engine. */ + readonly minorVersion?: string; + /** Possible states of a server. */ + readonly state?: ServerState; + /** Fully qualified domain name of a server. */ + readonly fullyQualifiedDomainName?: string; + /** Storage properties of a server. */ + storage?: Storage; + /** Authentication configuration properties of a server. */ + authConfig?: AuthConfig; + /** Data encryption properties of a server. */ + dataEncryption?: DataEncryption; + /** Backup properties of a server. */ + backup?: Backup; + /** Network properties of a server. Only required if you want your server to be integrated into a virtual network provided by customer. */ + network?: Network; + /** High availability properties of a server. */ + highAvailability?: HighAvailability; + /** Maintenance window properties of a server. */ + maintenanceWindow?: MaintenanceWindow; + /** Identifier of the server to be used as the source of the new server. Required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', 'Replica', or 'ReviveDropped'. This property is returned only when the target server is a read replica. */ + sourceServerResourceId?: string; + /** Creation time (in ISO8601 format) of the backup which you want to restore in the new server. It's required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', or 'ReviveDropped'. */ + pointInTimeUTC?: Date; + /** Availability zone of a server. */ + availabilityZone?: string; + /** Role of the server in a replication set. */ + replicationRole?: ReplicationRole; + /** Maximum number of read replicas allowed for a server. */ + readonly replicaCapacity?: number; + /** Read replica properties of a server. Required only in case that you want to promote a server. */ + replica?: Replica; + /** Creation mode of a new server. */ + createMode?: CreateMode; + /** List of private endpoint connections associated with the specified server. */ + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + /** Cluster properties of a server. */ + cluster?: Cluster; +} + +export function serverPropertiesSerializer(item: ServerProperties): any { + return { + administratorLogin: item["administratorLogin"], + administratorLoginPassword: item["administratorLoginPassword"], + version: item["version"], + storage: !item["storage"] ? item["storage"] : storageSerializer(item["storage"]), + authConfig: !item["authConfig"] ? item["authConfig"] : authConfigSerializer(item["authConfig"]), + dataEncryption: !item["dataEncryption"] + ? item["dataEncryption"] + : dataEncryptionSerializer(item["dataEncryption"]), + backup: !item["backup"] ? item["backup"] : backupSerializer(item["backup"]), + network: !item["network"] ? item["network"] : networkSerializer(item["network"]), + highAvailability: !item["highAvailability"] + ? item["highAvailability"] + : highAvailabilitySerializer(item["highAvailability"]), + maintenanceWindow: !item["maintenanceWindow"] + ? item["maintenanceWindow"] + : maintenanceWindowSerializer(item["maintenanceWindow"]), + sourceServerResourceId: item["sourceServerResourceId"], + pointInTimeUTC: !item["pointInTimeUTC"] + ? item["pointInTimeUTC"] + : item["pointInTimeUTC"].toISOString(), + availabilityZone: item["availabilityZone"], + replicationRole: item["replicationRole"], + replica: !item["replica"] ? item["replica"] : replicaSerializer(item["replica"]), + createMode: item["createMode"], + cluster: !item["cluster"] ? item["cluster"] : clusterSerializer(item["cluster"]), + }; +} + +export function serverPropertiesDeserializer(item: any): ServerProperties { + return { + administratorLogin: item["administratorLogin"], + administratorLoginPassword: item["administratorLoginPassword"], + version: item["version"], + minorVersion: item["minorVersion"], + state: item["state"], + fullyQualifiedDomainName: item["fullyQualifiedDomainName"], + storage: !item["storage"] ? item["storage"] : storageDeserializer(item["storage"]), + authConfig: !item["authConfig"] + ? item["authConfig"] + : authConfigDeserializer(item["authConfig"]), + dataEncryption: !item["dataEncryption"] + ? item["dataEncryption"] + : dataEncryptionDeserializer(item["dataEncryption"]), + backup: !item["backup"] ? item["backup"] : backupDeserializer(item["backup"]), + network: !item["network"] ? item["network"] : networkDeserializer(item["network"]), + highAvailability: !item["highAvailability"] + ? item["highAvailability"] + : highAvailabilityDeserializer(item["highAvailability"]), + maintenanceWindow: !item["maintenanceWindow"] + ? item["maintenanceWindow"] + : maintenanceWindowDeserializer(item["maintenanceWindow"]), + sourceServerResourceId: item["sourceServerResourceId"], + pointInTimeUTC: !item["pointInTimeUTC"] + ? item["pointInTimeUTC"] + : new Date(item["pointInTimeUTC"]), + availabilityZone: item["availabilityZone"], + replicationRole: item["replicationRole"], + replicaCapacity: item["replicaCapacity"], + replica: !item["replica"] ? item["replica"] : replicaDeserializer(item["replica"]), + createMode: item["createMode"], + privateEndpointConnections: !item["privateEndpointConnections"] + ? item["privateEndpointConnections"] + : privateEndpointConnectionArrayDeserializer(item["privateEndpointConnections"]), + cluster: !item["cluster"] ? item["cluster"] : clusterDeserializer(item["cluster"]), + }; +} + +/** Major version of PostgreSQL database engine. */ +export enum KnownPostgresMajorVersion { + /** 18 */ + Eighteen = "18", + /** 17 */ + Seventeen = "17", + /** 16 */ + Sixteen = "16", + /** 15 */ + Fifteen = "15", + /** 14 */ + Fourteen = "14", + /** 13 */ + Thirteen = "13", + /** 12 */ + Twelve = "12", + /** 11 */ + Eleven = "11", +} + +/** + * Major version of PostgreSQL database engine. \ + * {@link KnownPostgresMajorVersion} can be used interchangeably with PostgresMajorVersion, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **18** \ + * **17** \ + * **16** \ + * **15** \ + * **14** \ + * **13** \ + * **12** \ + * **11** + */ +export type PostgresMajorVersion = string; + +/** Possible states of a server. */ +export enum KnownServerState { + /** Ready */ + Ready = "Ready", + /** Dropping */ + Dropping = "Dropping", + /** Disabled */ + Disabled = "Disabled", + /** Starting */ + Starting = "Starting", + /** Stopping */ + Stopping = "Stopping", + /** Stopped */ + Stopped = "Stopped", + /** Updating */ + Updating = "Updating", + /** Restarting */ + Restarting = "Restarting", + /** Inaccessible */ + Inaccessible = "Inaccessible", + /** Provisioning */ + Provisioning = "Provisioning", +} + +/** + * Possible states of a server. \ + * {@link KnownServerState} can be used interchangeably with ServerState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Ready** \ + * **Dropping** \ + * **Disabled** \ + * **Starting** \ + * **Stopping** \ + * **Stopped** \ + * **Updating** \ + * **Restarting** \ + * **Inaccessible** \ + * **Provisioning** + */ +export type ServerState = string; + +/** Storage properties of a server. */ +export interface Storage { + /** Size of storage assigned to a server. */ + storageSizeGB?: number; + /** Flag to enable or disable the automatic growth of storage size of a server when available space is nearing zero and conditions allow for automatically growing storage size. */ + autoGrow?: StorageAutoGrow; + /** Storage tier of a server. */ + tier?: AzureManagedDiskPerformanceTier; + /** Maximum IOPS supported for storage. Required when type of storage is PremiumV2_LRS or UltraSSD_LRS. */ + iops?: number; + /** Maximum throughput supported for storage. Required when type of storage is PremiumV2_LRS or UltraSSD_LRS. */ + throughput?: number; + /** Type of storage assigned to a server. Allowed values are Premium_LRS, PremiumV2_LRS, or UltraSSD_LRS. If not specified, it defaults to Premium_LRS. */ + type?: StorageType; +} + +export function storageSerializer(item: Storage): any { + return { + storageSizeGB: item["storageSizeGB"], + autoGrow: item["autoGrow"], + tier: item["tier"], + iops: item["iops"], + throughput: item["throughput"], + type: item["type"], + }; +} + +export function storageDeserializer(item: any): Storage { + return { + storageSizeGB: item["storageSizeGB"], + autoGrow: item["autoGrow"], + tier: item["tier"], + iops: item["iops"], + throughput: item["throughput"], + type: item["type"], + }; +} + +/** Flag to enable or disable the automatic growth of storage size of a server when available space is nearing zero and conditions allow for automatically growing storage size. */ +export enum KnownStorageAutoGrow { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Flag to enable or disable the automatic growth of storage size of a server when available space is nearing zero and conditions allow for automatically growing storage size. \ + * {@link KnownStorageAutoGrow} can be used interchangeably with StorageAutoGrow, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type StorageAutoGrow = string; + +/** Storage tier of a server. */ +export enum KnownAzureManagedDiskPerformanceTier { + /** P1 */ + P1 = "P1", + /** P2 */ + P2 = "P2", + /** P3 */ + P3 = "P3", + /** P4 */ + P4 = "P4", + /** P6 */ + P6 = "P6", + /** P10 */ + P10 = "P10", + /** P15 */ + P15 = "P15", + /** P20 */ + P20 = "P20", + /** P30 */ + P30 = "P30", + /** P40 */ + P40 = "P40", + /** P50 */ + P50 = "P50", + /** P60 */ + P60 = "P60", + /** P70 */ + P70 = "P70", + /** P80 */ + P80 = "P80", +} + +/** + * Storage tier of a server. \ + * {@link KnownAzureManagedDiskPerformanceTier} can be used interchangeably with AzureManagedDiskPerformanceTier, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **P1** \ + * **P2** \ + * **P3** \ + * **P4** \ + * **P6** \ + * **P10** \ + * **P15** \ + * **P20** \ + * **P30** \ + * **P40** \ + * **P50** \ + * **P60** \ + * **P70** \ + * **P80** + */ +export type AzureManagedDiskPerformanceTier = string; + +/** Type of storage assigned to a server. Allowed values are Premium_LRS, PremiumV2_LRS, or UltraSSD_LRS. If not specified, it defaults to Premium_LRS. */ +export enum KnownStorageType { + /** Premium_LRS */ + PremiumLRS = "Premium_LRS", + /** PremiumV2_LRS */ + PremiumV2LRS = "PremiumV2_LRS", + /** UltraSSD_LRS */ + UltraSSDLRS = "UltraSSD_LRS", +} + +/** + * Type of storage assigned to a server. Allowed values are Premium_LRS, PremiumV2_LRS, or UltraSSD_LRS. If not specified, it defaults to Premium_LRS. \ + * {@link KnownStorageType} can be used interchangeably with StorageType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Premium_LRS** \ + * **PremiumV2_LRS** \ + * **UltraSSD_LRS** + */ +export type StorageType = string; + +/** Authentication configuration properties of a server. */ +export interface AuthConfig { + /** Indicates if the server supports Microsoft Entra authentication. */ + activeDirectoryAuth?: MicrosoftEntraAuth; + /** Indicates if the server supports password based authentication. */ + passwordAuth?: PasswordBasedAuth; + /** Identifier of the tenant of the delegated resource. */ + tenantId?: string; +} + +export function authConfigSerializer(item: AuthConfig): any { + return { + activeDirectoryAuth: item["activeDirectoryAuth"], + passwordAuth: item["passwordAuth"], + tenantId: item["tenantId"], + }; +} + +export function authConfigDeserializer(item: any): AuthConfig { + return { + activeDirectoryAuth: item["activeDirectoryAuth"], + passwordAuth: item["passwordAuth"], + tenantId: item["tenantId"], + }; +} + +/** Indicates if the server supports Microsoft Entra authentication. */ +export enum KnownMicrosoftEntraAuth { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if the server supports Microsoft Entra authentication. \ + * {@link KnownMicrosoftEntraAuth} can be used interchangeably with MicrosoftEntraAuth, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type MicrosoftEntraAuth = string; + +/** Indicates if the server supports password based authentication. */ +export enum KnownPasswordBasedAuth { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if the server supports password based authentication. \ + * {@link KnownPasswordBasedAuth} can be used interchangeably with PasswordBasedAuth, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type PasswordBasedAuth = string; + +/** Data encryption properties of a server. */ +export interface DataEncryption { + /** URI of the key in Azure Key Vault used for data encryption of the primary storage associated to a server. */ + primaryKeyURI?: string; + /** Identifier of the user assigned managed identity used to access the key in Azure Key Vault for data encryption of the primary storage associated to a server. */ + primaryUserAssignedIdentityId?: string; + /** Identifier of the user assigned managed identity used to access the key in Azure Key Vault for data encryption of the geographically redundant storage associated to a server that is configured to support geographically redundant backups. */ + geoBackupKeyURI?: string; + /** Identifier of the user assigned managed identity used to access the key in Azure Key Vault for data encryption of the geographically redundant storage associated to a server that is configured to support geographically redundant backups. */ + geoBackupUserAssignedIdentityId?: string; + /** Data encryption type used by a server. */ + type?: DataEncryptionType; + /** Status of key used by a server configured with data encryption based on customer managed key, to encrypt the primary storage associated to the server. */ + readonly primaryEncryptionKeyStatus?: EncryptionKeyStatus; + /** Status of key used by a server configured with data encryption based on customer managed key, to encrypt the geographically redundant storage associated to the server when it is configured to support geographically redundant backups. */ + readonly geoBackupEncryptionKeyStatus?: EncryptionKeyStatus; +} + +export function dataEncryptionSerializer(item: DataEncryption): any { + return { + primaryKeyURI: item["primaryKeyURI"], + primaryUserAssignedIdentityId: item["primaryUserAssignedIdentityId"], + geoBackupKeyURI: item["geoBackupKeyURI"], + geoBackupUserAssignedIdentityId: item["geoBackupUserAssignedIdentityId"], + type: item["type"], + }; +} + +export function dataEncryptionDeserializer(item: any): DataEncryption { + return { + primaryKeyURI: item["primaryKeyURI"], + primaryUserAssignedIdentityId: item["primaryUserAssignedIdentityId"], + geoBackupKeyURI: item["geoBackupKeyURI"], + geoBackupUserAssignedIdentityId: item["geoBackupUserAssignedIdentityId"], + type: item["type"], + primaryEncryptionKeyStatus: item["primaryEncryptionKeyStatus"], + geoBackupEncryptionKeyStatus: item["geoBackupEncryptionKeyStatus"], + }; +} + +/** Data encryption type used by a server. */ +export enum KnownDataEncryptionType { + /** SystemManaged */ + SystemManaged = "SystemManaged", + /** AzureKeyVault */ + AzureKeyVault = "AzureKeyVault", +} + +/** + * Data encryption type used by a server. \ + * {@link KnownDataEncryptionType} can be used interchangeably with DataEncryptionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SystemManaged** \ + * **AzureKeyVault** + */ +export type DataEncryptionType = string; + +/** Status of key used by a server configured with data encryption based on customer managed key, to encrypt the primary storage associated to the server. */ +export enum KnownEncryptionKeyStatus { + /** Valid */ + Valid = "Valid", + /** Invalid */ + Invalid = "Invalid", +} + +/** + * Status of key used by a server configured with data encryption based on customer managed key, to encrypt the primary storage associated to the server. \ + * {@link KnownEncryptionKeyStatus} can be used interchangeably with EncryptionKeyStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Valid** \ + * **Invalid** + */ +export type EncryptionKeyStatus = string; + +/** Backup properties of a server. */ +export interface Backup { + /** Backup retention days for the server. */ + backupRetentionDays?: number; + /** Indicates if the server is configured to create geographically redundant backups. */ + geoRedundantBackup?: GeographicallyRedundantBackup; + /** Earliest restore point time (ISO8601 format) for a server. */ + readonly earliestRestoreDate?: Date; +} + +export function backupSerializer(item: Backup): any { + return { + backupRetentionDays: item["backupRetentionDays"], + geoRedundantBackup: item["geoRedundantBackup"], + }; +} + +export function backupDeserializer(item: any): Backup { + return { + backupRetentionDays: item["backupRetentionDays"], + geoRedundantBackup: item["geoRedundantBackup"], + earliestRestoreDate: !item["earliestRestoreDate"] + ? item["earliestRestoreDate"] + : new Date(item["earliestRestoreDate"]), + }; +} + +/** Indicates if the server is configured to create geographically redundant backups. */ +export enum KnownGeographicallyRedundantBackup { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if the server is configured to create geographically redundant backups. \ + * {@link KnownGeographicallyRedundantBackup} can be used interchangeably with GeographicallyRedundantBackup, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type GeographicallyRedundantBackup = string; + +/** Network properties of a server. */ +export interface Network { + /** Indicates if public network access is enabled or not. This is only supported for servers that are not integrated into a virtual network which is owned and provided by customer when server is deployed. */ + publicNetworkAccess?: ServerPublicNetworkAccessState; + /** Resource identifier of the delegated subnet. Required during creation of a new server, in case you want the server to be integrated into your own virtual network. For an update operation, you only have to provide this property if you want to change the value assigned for the private DNS zone. */ + delegatedSubnetResourceId?: string; + /** Identifier of the private DNS zone. Required during creation of a new server, in case you want the server to be integrated into your own virtual network. For an update operation, you only have to provide this property if you want to change the value assigned for the private DNS zone. */ + privateDnsZoneArmResourceId?: string; +} + +export function networkSerializer(item: Network): any { + return { + publicNetworkAccess: item["publicNetworkAccess"], + delegatedSubnetResourceId: item["delegatedSubnetResourceId"], + privateDnsZoneArmResourceId: item["privateDnsZoneArmResourceId"], + }; +} + +export function networkDeserializer(item: any): Network { + return { + publicNetworkAccess: item["publicNetworkAccess"], + delegatedSubnetResourceId: item["delegatedSubnetResourceId"], + privateDnsZoneArmResourceId: item["privateDnsZoneArmResourceId"], + }; +} + +/** Indicates if public network access is enabled or not. */ +export enum KnownServerPublicNetworkAccessState { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if public network access is enabled or not. \ + * {@link KnownServerPublicNetworkAccessState} can be used interchangeably with ServerPublicNetworkAccessState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type ServerPublicNetworkAccessState = string; + +/** High availability properties of a server. */ +export interface HighAvailability { + /** High availability mode for a server. */ + mode?: PostgreSqlFlexibleServerHighAvailabilityMode; + /** Possible states of the standby server created when high availability is set to SameZone or ZoneRedundant. */ + readonly state?: HighAvailabilityState; + /** Availability zone associated to the standby server created when high availability is set to SameZone or ZoneRedundant. */ + standbyAvailabilityZone?: string; +} + +export function highAvailabilitySerializer(item: HighAvailability): any { + return { mode: item["mode"], standbyAvailabilityZone: item["standbyAvailabilityZone"] }; +} + +export function highAvailabilityDeserializer(item: any): HighAvailability { + return { + mode: item["mode"], + state: item["state"], + standbyAvailabilityZone: item["standbyAvailabilityZone"], + }; +} + +/** Modes of high availability supported for this compute. */ +export enum KnownPostgreSqlFlexibleServerHighAvailabilityMode { + /** Disabled */ + Disabled = "Disabled", + /** ZoneRedundant */ + ZoneRedundant = "ZoneRedundant", + /** SameZone */ + SameZone = "SameZone", +} + +/** + * Modes of high availability supported for this compute. \ + * {@link KnownPostgreSqlFlexibleServerHighAvailabilityMode} can be used interchangeably with PostgreSqlFlexibleServerHighAvailabilityMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Disabled** \ + * **ZoneRedundant** \ + * **SameZone** + */ +export type PostgreSqlFlexibleServerHighAvailabilityMode = string; + +/** Possible states of the standby server created when high availability is set to SameZone or ZoneRedundant. */ +export enum KnownHighAvailabilityState { + /** NotEnabled */ + NotEnabled = "NotEnabled", + /** CreatingStandby */ + CreatingStandby = "CreatingStandby", + /** ReplicatingData */ + ReplicatingData = "ReplicatingData", + /** FailingOver */ + FailingOver = "FailingOver", + /** Healthy */ + Healthy = "Healthy", + /** RemovingStandby */ + RemovingStandby = "RemovingStandby", +} + +/** + * Possible states of the standby server created when high availability is set to SameZone or ZoneRedundant. \ + * {@link KnownHighAvailabilityState} can be used interchangeably with HighAvailabilityState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotEnabled** \ + * **CreatingStandby** \ + * **ReplicatingData** \ + * **FailingOver** \ + * **Healthy** \ + * **RemovingStandby** + */ +export type HighAvailabilityState = string; + +/** Maintenance window properties of a server. */ +export interface MaintenanceWindow { + /** Indicates whether custom window is enabled or disabled. */ + customWindow?: string; + /** Start hour to be used for maintenance window. */ + startHour?: number; + /** Start minute to be used for maintenance window. */ + startMinute?: number; + /** Day of the week to be used for maintenance window. */ + dayOfWeek?: number; +} + +export function maintenanceWindowSerializer(item: MaintenanceWindow): any { + return { + customWindow: item["customWindow"], + startHour: item["startHour"], + startMinute: item["startMinute"], + dayOfWeek: item["dayOfWeek"], + }; +} + +export function maintenanceWindowDeserializer(item: any): MaintenanceWindow { + return { + customWindow: item["customWindow"], + startHour: item["startHour"], + startMinute: item["startMinute"], + dayOfWeek: item["dayOfWeek"], + }; +} + +/** Role of the server in a replication set. */ +export enum KnownReplicationRole { + /** None */ + None = "None", + /** Primary */ + Primary = "Primary", + /** AsyncReplica */ + AsyncReplica = "AsyncReplica", + /** GeoAsyncReplica */ + GeoAsyncReplica = "GeoAsyncReplica", +} + +/** + * Role of the server in a replication set. \ + * {@link KnownReplicationRole} can be used interchangeably with ReplicationRole, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Primary** \ + * **AsyncReplica** \ + * **GeoAsyncReplica** + */ +export type ReplicationRole = string; + +/** Replica properties of a server. */ +export interface Replica { + /** Role of the server in a replication set. */ + role?: ReplicationRole; + /** Maximum number of read replicas allowed for a server. */ + readonly capacity?: number; + /** Indicates the replication state of a read replica. This property is returned only when the target server is a read replica. Possible values are Active, Broken, Catchup, Provisioning, Reconfiguring, and Updating */ + readonly replicationState?: ReplicationState; + /** Type of operation to apply on the read replica. This property is write only. Standalone means that the read replica will be promoted to a standalone server, and will become a completely independent entity from the replication set. Switchover means that the read replica will roles with the primary server. */ + promoteMode?: ReadReplicaPromoteMode; + /** Data synchronization option to use when processing the operation specified in the promoteMode property. This property is write only. */ + promoteOption?: ReadReplicaPromoteOption; +} + +export function replicaSerializer(item: Replica): any { + return { + role: item["role"], + promoteMode: item["promoteMode"], + promoteOption: item["promoteOption"], + }; +} + +export function replicaDeserializer(item: any): Replica { + return { + role: item["role"], + capacity: item["capacity"], + replicationState: item["replicationState"], + promoteMode: item["promoteMode"], + promoteOption: item["promoteOption"], + }; +} + +/** Indicates the replication state of a read replica. This property is returned only when the target server is a read replica. Possible values are Active, Broken, Catchup, Provisioning, Reconfiguring, and Updating */ +export enum KnownReplicationState { + /** The read replica server is fully synchronized and actively replicating data from the primary server. */ + Active = "Active", + /** The read replica server is behind the primary server and is currently catching up with pending changes. */ + Catchup = "Catchup", + /** The read replica server is being created and is in process of getting initialized. */ + Provisioning = "Provisioning", + /** The read replica server is undergoing some changes it can be changing compute size of promoting it to primary server. */ + Updating = "Updating", + /** Replication has failed or been interrupted. */ + Broken = "Broken", + /** The read replica server is being reconfigured, possibly due to changes in source or settings. */ + Reconfiguring = "Reconfiguring", +} + +/** + * Indicates the replication state of a read replica. This property is returned only when the target server is a read replica. Possible values are Active, Broken, Catchup, Provisioning, Reconfiguring, and Updating \ + * {@link KnownReplicationState} can be used interchangeably with ReplicationState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: The read replica server is fully synchronized and actively replicating data from the primary server. \ + * **Catchup**: The read replica server is behind the primary server and is currently catching up with pending changes. \ + * **Provisioning**: The read replica server is being created and is in process of getting initialized. \ + * **Updating**: The read replica server is undergoing some changes it can be changing compute size of promoting it to primary server. \ + * **Broken**: Replication has failed or been interrupted. \ + * **Reconfiguring**: The read replica server is being reconfigured, possibly due to changes in source or settings. + */ +export type ReplicationState = string; + +/** Type of operation to apply on the read replica. This property is write only. Standalone means that the read replica will be promoted to a standalone server, and will become a completely independent entity from the replication set. Switchover means that the read replica will roles with the primary server. */ +export enum KnownReadReplicaPromoteMode { + /** Read replica will become an independent server. */ + Standalone = "Standalone", + /** Read replica will swap roles with primary server. */ + Switchover = "Switchover", +} + +/** + * Type of operation to apply on the read replica. This property is write only. Standalone means that the read replica will be promoted to a standalone server, and will become a completely independent entity from the replication set. Switchover means that the read replica will roles with the primary server. \ + * {@link KnownReadReplicaPromoteMode} can be used interchangeably with ReadReplicaPromoteMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Standalone**: Read replica will become an independent server. \ + * **Switchover**: Read replica will swap roles with primary server. + */ +export type ReadReplicaPromoteMode = string; + +/** Data synchronization option to use when processing the operation specified in the promoteMode property. This property is write only. */ +export enum KnownReadReplicaPromoteOption { + /** The operation will wait for data in the read replica to be fully synchronized with its source server, before it initiates the operation. */ + Planned = "Planned", + /** The operation will not wait for data in the read replica to be synchronized with its source server, before it initiates the operation. */ + Forced = "Forced", +} + +/** + * Data synchronization option to use when processing the operation specified in the promoteMode property. This property is write only. \ + * {@link KnownReadReplicaPromoteOption} can be used interchangeably with ReadReplicaPromoteOption, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Planned**: The operation will wait for data in the read replica to be fully synchronized with its source server, before it initiates the operation. \ + * **Forced**: The operation will not wait for data in the read replica to be synchronized with its source server, before it initiates the operation. + */ +export type ReadReplicaPromoteOption = string; + +/** Creation mode of a new server. */ +export enum KnownCreateMode { + /** Default */ + Default = "Default", + /** Create */ + Create = "Create", + /** Update */ + Update = "Update", + /** PointInTimeRestore */ + PointInTimeRestore = "PointInTimeRestore", + /** GeoRestore */ + GeoRestore = "GeoRestore", + /** Replica */ + Replica = "Replica", + /** ReviveDropped */ + ReviveDropped = "ReviveDropped", +} + +/** + * Creation mode of a new server. \ + * {@link KnownCreateMode} can be used interchangeably with CreateMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Default** \ + * **Create** \ + * **Update** \ + * **PointInTimeRestore** \ + * **GeoRestore** \ + * **Replica** \ + * **ReviveDropped** + */ +export type CreateMode = string; + +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 Resource { + /** The group ids for the private endpoint resource. */ + readonly groupIds?: string[]; + /** The private endpoint resource. */ + privateEndpoint?: PrivateEndpoint; + /** A collection of information about the state of the connection between service consumer and provider. */ + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; + /** The provisioning state of the private endpoint connection resource. */ + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +export function privateEndpointConnectionSerializer(item: PrivateEndpointConnection): any { + return { + properties: areAllPropsUndefined(item, ["privateEndpoint", "privateLinkServiceConnectionState"]) + ? undefined + : _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 private endpoint connection. */ +export interface PrivateEndpointConnectionProperties { + /** The group ids for the private endpoint resource. */ + readonly groupIds?: string[]; + /** The private endpoint resource. */ + privateEndpoint?: PrivateEndpoint; + /** A collection of information about the state of the connection between service consumer and provider. */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + /** The provisioning state of the private endpoint connection resource. */ + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +export function privateEndpointConnectionPropertiesSerializer( + item: PrivateEndpointConnectionProperties, +): any { + return { + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointSerializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: privateLinkServiceConnectionStateSerializer( + item["privateLinkServiceConnectionState"], + ), + }; +} + +export function privateEndpointConnectionPropertiesDeserializer( + item: any, +): PrivateEndpointConnectionProperties { + return { + groupIds: !item["groupIds"] + ? item["groupIds"] + : item["groupIds"].map((p: any) => { + return p; + }), + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointDeserializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: privateLinkServiceConnectionStateDeserializer( + item["privateLinkServiceConnectionState"], + ), + provisioningState: item["provisioningState"], + }; +} + +/** The private endpoint resource. */ +export interface PrivateEndpoint { + /** The resource identifier of the private endpoint */ + readonly id?: string; +} + +export function privateEndpointSerializer(item: PrivateEndpoint): any { + return item; +} + +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 { + /** Connection waiting for approval or rejection */ + Pending = "Pending", + /** Connection approved */ + Approved = "Approved", + /** Connection 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**: Connection waiting for approval or rejection \ + * **Approved**: Connection approved \ + * **Rejected**: Connection Rejected + */ +export type PrivateEndpointServiceConnectionStatus = string; + +/** The current provisioning state. */ +export enum KnownPrivateEndpointConnectionProvisioningState { + /** Connection has been provisioned */ + Succeeded = "Succeeded", + /** Connection is being created */ + Creating = "Creating", + /** Connection is being deleted */ + Deleting = "Deleting", + /** Connection provisioning has 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**: Connection has been provisioned \ + * **Creating**: Connection is being created \ + * **Deleting**: Connection is being deleted \ + * **Failed**: Connection provisioning has failed + */ +export type PrivateEndpointConnectionProvisioningState = string; + +/** Cluster properties of a server. */ +export interface Cluster { + /** Number of nodes assigned to the elastic cluster. */ + clusterSize?: number; + /** Default database name for the elastic cluster. */ + defaultDatabaseName?: string; +} + +export function clusterSerializer(item: Cluster): any { + return { clusterSize: item["clusterSize"], defaultDatabaseName: item["defaultDatabaseName"] }; +} + +export function clusterDeserializer(item: any): Cluster { + return { + clusterSize: item["clusterSize"], + defaultDatabaseName: item["defaultDatabaseName"], + }; +} + +/** Compute information of a server. */ +export interface Sku { + /** Name by which is known a given compute size assigned to a server. */ + name: string; + /** Tier of the compute assigned to a server. */ + tier: SkuTier; +} + +export function skuSerializer(item: Sku): any { + return { name: item["name"], tier: item["tier"] }; +} + +export function skuDeserializer(item: any): Sku { + return { + name: item["name"], + tier: item["tier"], + }; +} + +/** Identities associated with a server. */ +export interface UserAssignedIdentity { + /** Map of user assigned managed identities. */ + userAssignedIdentities?: Record; + /** Identifier of the object of the service principal associated to the user assigned managed identity. */ + principalId?: string; + /** Types of identities associated with a server. */ + type: IdentityType; + /** Identifier of the tenant of a server. */ + readonly tenantId?: string; +} + +export function userAssignedIdentitySerializer(item: UserAssignedIdentity): any { + return { + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userIdentityRecordSerializer(item["userAssignedIdentities"]), + principalId: item["principalId"], + type: item["type"], + }; +} + +export function userAssignedIdentityDeserializer(item: any): UserAssignedIdentity { + return { + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userIdentityRecordDeserializer(item["userAssignedIdentities"]), + principalId: item["principalId"], + type: item["type"], + tenantId: item["tenantId"], + }; +} + +export function userIdentityRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : userIdentitySerializer(item[key]); + }); + return result; +} + +export function userIdentityRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : userIdentityDeserializer(item[key]); + }); + return result; +} + +/** User assigned managed identity associated with a server. */ +export interface UserIdentity { + /** Identifier of the object of the service principal associated to the user assigned managed identity. */ + principalId?: string; + /** Identifier of the client of the service principal associated to the user assigned managed identity. */ + clientId?: string; +} + +export function userIdentitySerializer(item: UserIdentity): any { + return { principalId: item["principalId"], clientId: item["clientId"] }; +} + +export function userIdentityDeserializer(item: any): UserIdentity { + return { + principalId: item["principalId"], + clientId: item["clientId"], + }; +} + +/** Types of identities associated with a server. */ +export enum KnownIdentityType { + /** None */ + None = "None", + /** UserAssigned */ + UserAssigned = "UserAssigned", + /** SystemAssigned */ + SystemAssigned = "SystemAssigned", + /** SystemAssigned,UserAssigned */ + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned", +} + +/** + * Types of identities associated with a server. \ + * {@link KnownIdentityType} can be used interchangeably with IdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **UserAssigned** \ + * **SystemAssigned** \ + * **SystemAssigned,UserAssigned** + */ +export type IdentityType = string; + +/** Represents a server to be updated. */ +export interface ServerForPatch { + /** Compute tier and size of a server. */ + sku?: SkuForPatch; + /** Describes the identity of the application. */ + identity?: UserAssignedIdentity; + /** Application-specific metadata in the form of key-value pairs. */ + tags?: Record; + /** Name of the login designated as the first password based administrator assigned to your instance of PostgreSQL. Must be specified the first time that you enable password based authentication on a server. Once set to a given value, it cannot be changed for the rest of the life of a server. If you disable password based authentication on a server which had it enabled, this password based role isn't deleted. */ + readonly administratorLogin?: string; + /** Password assigned to the administrator login. As long as password authentication is enabled, this password can be changed at any time. */ + administratorLoginPassword?: string; + /** Major version of PostgreSQL database engine. */ + version?: PostgresMajorVersion; + /** Storage properties of a server. */ + storage?: Storage; + /** Backup properties of a server. */ + backup?: BackupForPatch; + /** High availability properties of a server. */ + highAvailability?: HighAvailabilityForPatch; + /** Maintenance window properties of a server. */ + maintenanceWindow?: MaintenanceWindowForPatch; + /** Authentication configuration properties of a server. */ + authConfig?: AuthConfigForPatch; + /** Data encryption properties of a server. */ + dataEncryption?: DataEncryption; + /** Availability zone of a server. */ + availabilityZone?: string; + /** Update mode of an existing server. */ + createMode?: CreateModeForPatch; + /** Role of the server in a replication set. */ + replicationRole?: ReplicationRole; + /** Read replica properties of a server. Required only in case that you want to promote a server. */ + replica?: Replica; + /** Network properties of a server. Only required if you want your server to be integrated into a virtual network provided by customer. */ + network?: Network; + /** Cluster properties of a server. */ + cluster?: Cluster; +} + +export function serverForPatchSerializer(item: ServerForPatch): any { + return { + sku: !item["sku"] ? item["sku"] : skuForPatchSerializer(item["sku"]), + identity: !item["identity"] + ? item["identity"] + : userAssignedIdentitySerializer(item["identity"]), + properties: areAllPropsUndefined(item, [ + "administratorLoginPassword", + "version", + "storage", + "backup", + "highAvailability", + "maintenanceWindow", + "authConfig", + "dataEncryption", + "availabilityZone", + "createMode", + "replicationRole", + "replica", + "network", + "cluster", + ]) + ? undefined + : _serverForPatchPropertiesSerializer(item), + tags: item["tags"], + }; +} + +/** Compute information of a server. */ +export interface SkuForPatch { + /** Name by which is known a given compute size assigned to a server. */ + name?: string; + /** Tier of the compute assigned to a server. */ + tier?: SkuTier; +} + +export function skuForPatchSerializer(item: SkuForPatch): any { + return { name: item["name"], tier: item["tier"] }; +} + +/** Properties of a server. */ +export interface ServerPropertiesForPatch { + /** Name of the login designated as the first password based administrator assigned to your instance of PostgreSQL. Must be specified the first time that you enable password based authentication on a server. Once set to a given value, it cannot be changed for the rest of the life of a server. If you disable password based authentication on a server which had it enabled, this password based role isn't deleted. */ + readonly administratorLogin?: string; + /** Password assigned to the administrator login. As long as password authentication is enabled, this password can be changed at any time. */ + administratorLoginPassword?: string; + /** Major version of PostgreSQL database engine. */ + version?: PostgresMajorVersion; + /** Storage properties of a server. */ + storage?: Storage; + /** Backup properties of a server. */ + backup?: BackupForPatch; + /** High availability properties of a server. */ + highAvailability?: HighAvailabilityForPatch; + /** Maintenance window properties of a server. */ + maintenanceWindow?: MaintenanceWindowForPatch; + /** Authentication configuration properties of a server. */ + authConfig?: AuthConfigForPatch; + /** Data encryption properties of a server. */ + dataEncryption?: DataEncryption; + /** Availability zone of a server. */ + availabilityZone?: string; + /** Update mode of an existing server. */ + createMode?: CreateModeForPatch; + /** Role of the server in a replication set. */ + replicationRole?: ReplicationRole; + /** Read replica properties of a server. Required only in case that you want to promote a server. */ + replica?: Replica; + /** Network properties of a server. Only required if you want your server to be integrated into a virtual network provided by customer. */ + network?: Network; + /** Cluster properties of a server. */ + cluster?: Cluster; +} + +export function serverPropertiesForPatchSerializer(item: ServerPropertiesForPatch): any { + return { + administratorLoginPassword: item["administratorLoginPassword"], + version: item["version"], + storage: !item["storage"] ? item["storage"] : storageSerializer(item["storage"]), + backup: !item["backup"] ? item["backup"] : backupForPatchSerializer(item["backup"]), + highAvailability: !item["highAvailability"] + ? item["highAvailability"] + : highAvailabilityForPatchSerializer(item["highAvailability"]), + maintenanceWindow: !item["maintenanceWindow"] + ? item["maintenanceWindow"] + : maintenanceWindowForPatchSerializer(item["maintenanceWindow"]), + authConfig: !item["authConfig"] + ? item["authConfig"] + : authConfigForPatchSerializer(item["authConfig"]), + dataEncryption: !item["dataEncryption"] + ? item["dataEncryption"] + : dataEncryptionSerializer(item["dataEncryption"]), + availabilityZone: item["availabilityZone"], + createMode: item["createMode"], + replicationRole: item["replicationRole"], + replica: !item["replica"] ? item["replica"] : replicaSerializer(item["replica"]), + network: !item["network"] ? item["network"] : networkSerializer(item["network"]), + cluster: !item["cluster"] ? item["cluster"] : clusterSerializer(item["cluster"]), + }; +} + +/** Backup properties of a server. */ +export interface BackupForPatch { + /** Backup retention days for the server. */ + backupRetentionDays?: number; + /** Indicates if the server is configured to create geographically redundant backups. */ + readonly geoRedundantBackup?: GeographicallyRedundantBackup; + /** Earliest restore point time (ISO8601 format) for a server. */ + readonly earliestRestoreDate?: Date; +} + +export function backupForPatchSerializer(item: BackupForPatch): any { + return { backupRetentionDays: item["backupRetentionDays"] }; +} + +/** High availability properties of a server. */ +export interface HighAvailabilityForPatch { + /** High availability mode for a server. */ + mode?: PostgreSqlFlexibleServerHighAvailabilityMode; + /** Possible states of the standby server created when high availability is set to SameZone or ZoneRedundant. */ + readonly state?: HighAvailabilityState; + /** Availability zone associated to the standby server created when high availability is set to SameZone or ZoneRedundant. */ + standbyAvailabilityZone?: string; +} + +export function highAvailabilityForPatchSerializer(item: HighAvailabilityForPatch): any { + return { mode: item["mode"], standbyAvailabilityZone: item["standbyAvailabilityZone"] }; +} + +/** Maintenance window properties of a server. */ +export interface MaintenanceWindowForPatch { + /** Indicates whether custom window is enabled or disabled. */ + customWindow?: string; + /** Start hour to be used for maintenance window. */ + startHour?: number; + /** Start minute to be used for maintenance window. */ + startMinute?: number; + /** Day of the week to be used for maintenance window. */ + dayOfWeek?: number; +} + +export function maintenanceWindowForPatchSerializer(item: MaintenanceWindowForPatch): any { + return { + customWindow: item["customWindow"], + startHour: item["startHour"], + startMinute: item["startMinute"], + dayOfWeek: item["dayOfWeek"], + }; +} + +/** Authentication configuration properties of a server. */ +export interface AuthConfigForPatch { + /** Indicates if the server supports Microsoft Entra authentication. */ + activeDirectoryAuth?: MicrosoftEntraAuth; + /** Indicates if the server supports password based authentication. */ + passwordAuth?: PasswordBasedAuth; + /** Identifier of the tenant of the delegated resource. */ + tenantId?: string; +} + +export function authConfigForPatchSerializer(item: AuthConfigForPatch): any { + return { + activeDirectoryAuth: item["activeDirectoryAuth"], + passwordAuth: item["passwordAuth"], + tenantId: item["tenantId"], + }; +} + +/** Update mode of an existing server. */ +export enum KnownCreateModeForPatch { + /** Default */ + Default = "Default", + /** Update */ + Update = "Update", +} + +/** + * Update mode of an existing server. \ + * {@link KnownCreateModeForPatch} can be used interchangeably with CreateModeForPatch, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Default** \ + * **Update** + */ +export type CreateModeForPatch = string; + +/** A list of servers. */ +export interface _ServerList { + /** The Server items on this page */ + value: Server[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _serverListDeserializer(item: any): _ServerList { + return { + value: serverArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function serverArraySerializer(result: Array): any[] { + return result.map((item) => { + return serverSerializer(item); + }); +} + +export function serverArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return serverDeserializer(item); + }); +} + +/** PostgreSQL database engine restart parameters. */ +export interface RestartParameter { + /** Indicates if restart the PostgreSQL database engine should failover or switch over from primary to standby. This only works if server has high availability enabled. */ + restartWithFailover?: boolean; + /** Failover mode. */ + failoverMode?: FailoverMode; +} + +export function restartParameterSerializer(item: RestartParameter): any { + return { restartWithFailover: item["restartWithFailover"], failoverMode: item["failoverMode"] }; +} + +/** Failover mode. */ +export enum KnownFailoverMode { + /** PlannedFailover */ + PlannedFailover = "PlannedFailover", + /** ForcedFailover */ + ForcedFailover = "ForcedFailover", + /** PlannedSwitchover */ + PlannedSwitchover = "PlannedSwitchover", + /** ForcedSwitchover */ + ForcedSwitchover = "ForcedSwitchover", +} + +/** + * Failover mode. \ + * {@link KnownFailoverMode} can be used interchangeably with FailoverMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **PlannedFailover** \ + * **ForcedFailover** \ + * **PlannedSwitchover** \ + * **ForcedSwitchover** + */ +export type FailoverMode = string; + +/** The status of a network migration operation. */ +export interface MigrateNetworkStatus { + /** The ID of the subscription. */ + subscriptionId?: string; + /** The name of the resource group. */ + resourceGroupName?: string; + /** The name of the server. */ + serverName?: string; + /** The state of the network migration operation. */ + readonly state?: NetworkMigrationState; +} + +export function migrateNetworkStatusDeserializer(item: any): MigrateNetworkStatus { + return { + subscriptionId: item["subscriptionId"], + resourceGroupName: item["resourceGroupName"], + serverName: item["serverName"], + state: item["state"], + }; +} + +/** The state of the network migration operation. */ +export enum KnownNetworkMigrationState { + /** The network migration is pending. */ + Pending = "Pending", + /** The network migration is in progress. */ + InProgress = "InProgress", + /** The network migration succeeded. */ + Succeeded = "Succeeded", + /** The network migration failed. */ + Failed = "Failed", + /** The network migration cancellation is in progress. */ + CancelInProgress = "CancelInProgress", + /** The network migration was cancelled. */ + Cancelled = "Cancelled", +} + +/** + * The state of the network migration operation. \ + * {@link KnownNetworkMigrationState} can be used interchangeably with NetworkMigrationState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending**: The network migration is pending. \ + * **InProgress**: The network migration is in progress. \ + * **Succeeded**: The network migration succeeded. \ + * **Failed**: The network migration failed. \ + * **CancelInProgress**: The network migration cancellation is in progress. \ + * **Cancelled**: The network migration was cancelled. + */ +export type NetworkMigrationState = string; + +/** Configuration (also known as server parameter). */ +export interface Configuration extends ProxyResource { + /** Value of the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ + value?: string; + /** Description of the configuration (also known as server parameter). */ + readonly description?: string; + /** Value assigned by default to the configuration (also known as server parameter). */ + readonly defaultValue?: string; + /** Data type of the configuration (also known as server parameter). */ + readonly dataType?: ConfigurationDataType; + /** Allowed values of the configuration (also known as server parameter). */ + readonly allowedValues?: string; + /** Source of the value assigned to the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ + source?: string; + /** Indicates if it's a dynamic (true) or static (false) configuration (also known as server parameter). Static server parameters require a server restart after changing the value assigned to them, for the change to take effect. Dynamic server parameters do not require a server restart after changing the value assigned to them, for the change to take effect. */ + readonly isDynamicConfig?: boolean; + /** Indicates if it's a read-only (true) or modifiable (false) configuration (also known as server parameter). */ + readonly isReadOnly?: boolean; + /** Indicates if the value assigned to the configuration (also known as server parameter) is pending a server restart for it to take effect. */ + readonly isConfigPendingRestart?: boolean; + /** Units in which the configuration (also known as server parameter) value is expressed. */ + readonly unit?: string; + /** Link pointing to the documentation of the configuration (also known as server parameter). */ + readonly documentationLink?: string; +} + +export function configurationDeserializer(item: any): Configuration { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _configurationPropertiesDeserializer(item["properties"])), + }; +} + +/** Properties of a configuration (also known as server parameter). */ +export interface ConfigurationProperties { + /** Value of the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ + value?: string; + /** Description of the configuration (also known as server parameter). */ + readonly description?: string; + /** Value assigned by default to the configuration (also known as server parameter). */ + readonly defaultValue?: string; + /** Data type of the configuration (also known as server parameter). */ + readonly dataType?: ConfigurationDataType; + /** Allowed values of the configuration (also known as server parameter). */ + readonly allowedValues?: string; + /** Source of the value assigned to the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ + source?: string; + /** Indicates if it's a dynamic (true) or static (false) configuration (also known as server parameter). Static server parameters require a server restart after changing the value assigned to them, for the change to take effect. Dynamic server parameters do not require a server restart after changing the value assigned to them, for the change to take effect. */ + readonly isDynamicConfig?: boolean; + /** Indicates if it's a read-only (true) or modifiable (false) configuration (also known as server parameter). */ + readonly isReadOnly?: boolean; + /** Indicates if the value assigned to the configuration (also known as server parameter) is pending a server restart for it to take effect. */ + readonly isConfigPendingRestart?: boolean; + /** Units in which the configuration (also known as server parameter) value is expressed. */ + readonly unit?: string; + /** Link pointing to the documentation of the configuration (also known as server parameter). */ + readonly documentationLink?: string; +} + +export function configurationPropertiesSerializer(item: ConfigurationProperties): any { + return { value: item["value"], source: item["source"] }; +} + +export function configurationPropertiesDeserializer(item: any): ConfigurationProperties { + return { + value: item["value"], + description: item["description"], + defaultValue: item["defaultValue"], + dataType: item["dataType"], + allowedValues: item["allowedValues"], + source: item["source"], + isDynamicConfig: item["isDynamicConfig"], + isReadOnly: item["isReadOnly"], + isConfigPendingRestart: item["isConfigPendingRestart"], + unit: item["unit"], + documentationLink: item["documentationLink"], + }; +} + +/** Data type of the configuration (also known as server parameter). */ +export enum KnownConfigurationDataType { + /** Boolean */ + Boolean = "Boolean", + /** Numeric */ + Numeric = "Numeric", + /** Integer */ + Integer = "Integer", + /** Enumeration */ + Enumeration = "Enumeration", + /** String */ + String = "String", + /** Set */ + Set = "Set", +} + +/** + * Data type of the configuration (also known as server parameter). \ + * {@link KnownConfigurationDataType} can be used interchangeably with ConfigurationDataType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Boolean** \ + * **Numeric** \ + * **Integer** \ + * **Enumeration** \ + * **String** \ + * **Set** + */ +export type ConfigurationDataType = 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"]), + }; +} + +/** Configuration (also known as server parameter). */ +export interface ConfigurationForUpdate { + /** Value of the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ + value?: string; + /** Description of the configuration (also known as server parameter). */ + readonly description?: string; + /** Value assigned by default to the configuration (also known as server parameter). */ + readonly defaultValue?: string; + /** Data type of the configuration (also known as server parameter). */ + readonly dataType?: ConfigurationDataType; + /** Allowed values of the configuration (also known as server parameter). */ + readonly allowedValues?: string; + /** Source of the value assigned to the configuration (also known as server parameter). Required to update the value assigned to a specific modifiable configuration. */ + source?: string; + /** Indicates if it's a dynamic (true) or static (false) configuration (also known as server parameter). Static server parameters require a server restart after changing the value assigned to them, for the change to take effect. Dynamic server parameters do not require a server restart after changing the value assigned to them, for the change to take effect. */ + readonly isDynamicConfig?: boolean; + /** Indicates if it's a read-only (true) or modifiable (false) configuration (also known as server parameter). */ + readonly isReadOnly?: boolean; + /** Indicates if the value assigned to the configuration (also known as server parameter) is pending a server restart for it to take effect. */ + readonly isConfigPendingRestart?: boolean; + /** Units in which the configuration (also known as server parameter) value is expressed. */ + readonly unit?: string; + /** Link pointing to the documentation of the configuration (also known as server parameter). */ + readonly documentationLink?: string; +} + +export function configurationForUpdateSerializer(item: ConfigurationForUpdate): any { + return { + properties: areAllPropsUndefined(item, ["value", "source"]) + ? undefined + : _configurationForUpdatePropertiesSerializer(item), + }; +} + +/** List of configurations (also known as server parameters). */ +export interface _ConfigurationList { + /** The Configuration items on this page */ + value: Configuration[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _configurationListDeserializer(item: any): _ConfigurationList { + return { + value: configurationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function configurationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return configurationDeserializer(item); + }); +} + +/** Represents a database. */ +export interface Database extends ProxyResource { + /** Character set of the database. */ + charset?: string; + /** Collation of the database. */ + collation?: string; +} + +export function databaseSerializer(item: Database): any { + return { + properties: areAllPropsUndefined(item, ["charset", "collation"]) + ? undefined + : _databasePropertiesSerializer(item), + }; +} + +export function databaseDeserializer(item: any): Database { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _databasePropertiesDeserializer(item["properties"])), + }; +} + +/** Properties of a database. */ +export interface DatabaseProperties { + /** Character set of the database. */ + charset?: string; + /** Collation of the database. */ + collation?: string; +} + +export function databasePropertiesSerializer(item: DatabaseProperties): any { + return { charset: item["charset"], collation: item["collation"] }; +} + +export function databasePropertiesDeserializer(item: any): DatabaseProperties { + return { + charset: item["charset"], + collation: item["collation"], + }; +} + +/** List of all databases in a server. */ +export interface _DatabaseList { + /** The Database items on this page */ + value: Database[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _databaseListDeserializer(item: any): _DatabaseList { + return { + value: databaseArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function databaseArraySerializer(result: Array): any[] { + return result.map((item) => { + return databaseSerializer(item); + }); +} + +export function databaseArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return databaseDeserializer(item); + }); +} + +/** Firewall rule. */ +export interface FirewallRule extends ProxyResource { + /** IP address defining the start of the range of addresses of a firewall rule. Must be expressed in IPv4 format. */ + startIpAddress: string; + /** IP address defining the end of the range of addresses of a firewall rule. Must be expressed in IPv4 format. */ + endIpAddress: string; +} + +export function firewallRuleSerializer(item: FirewallRule): any { + return { properties: _firewallRulePropertiesSerializer(item) }; +} + +export function firewallRuleDeserializer(item: any): FirewallRule { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ..._firewallRulePropertiesDeserializer(item["properties"]), + }; +} + +/** Properties of a firewall rule. */ +export interface FirewallRuleProperties { + /** IP address defining the start of the range of addresses of a firewall rule. Must be expressed in IPv4 format. */ + startIpAddress: string; + /** IP address defining the end of the range of addresses of a firewall rule. Must be expressed in IPv4 format. */ + endIpAddress: string; +} + +export function firewallRulePropertiesSerializer(item: FirewallRuleProperties): any { + return { startIpAddress: item["startIpAddress"], endIpAddress: item["endIpAddress"] }; +} + +export function firewallRulePropertiesDeserializer(item: any): FirewallRuleProperties { + return { + startIpAddress: item["startIpAddress"], + endIpAddress: item["endIpAddress"], + }; +} + +/** List of firewall rules. */ +export interface _FirewallRuleList { + /** The FirewallRule items on this page */ + value: FirewallRule[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _firewallRuleListDeserializer(item: any): _FirewallRuleList { + return { + value: firewallRuleArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function firewallRuleArraySerializer(result: Array): any[] { + return result.map((item) => { + return firewallRuleSerializer(item); + }); +} + +export function firewallRuleArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return firewallRuleDeserializer(item); + }); +} + +/** List of private endpoint connections. */ +export interface _PrivateEndpointConnectionList { + /** The PrivateEndpointConnection items on this page */ + readonly value: PrivateEndpointConnection[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _privateEndpointConnectionListDeserializer( + item: any, +): _PrivateEndpointConnectionList { + return { + value: privateEndpointConnectionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +/** A private link resource. */ +export interface PrivateLinkResource extends ProxyResource { + /** The private link resource group id. */ + readonly groupId?: string; + /** The private link resource required member names. */ + readonly requiredMembers?: string[]; + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; +} + +export function privateLinkResourceDeserializer(item: any): PrivateLinkResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _privateLinkResourcePropertiesDeserializer(item["properties"])), + }; +} + +/** 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 private link 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 _PrivateLinkResourceList { + /** The PrivateLinkResource items on this page */ + readonly value: PrivateLinkResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _privateLinkResourceListDeserializer(item: any): _PrivateLinkResourceList { + return { + value: privateLinkResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function privateLinkResourceArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return privateLinkResourceDeserializer(item); + }); +} + +/** Pair of virtual endpoints for a server. */ +export interface VirtualEndpoint extends ProxyResource { + /** Type of endpoint for the virtual endpoints. */ + endpointType?: VirtualEndpointType; + /** List of servers that one of the virtual endpoints can refer to. */ + members?: string[]; + /** List of virtual endpoints for a server. */ + readonly virtualEndpoints?: string[]; +} + +export function virtualEndpointSerializer(item: VirtualEndpoint): any { + return { + properties: areAllPropsUndefined(item, ["endpointType", "members"]) + ? undefined + : _virtualEndpointPropertiesSerializer(item), + }; +} + +export function virtualEndpointDeserializer(item: any): VirtualEndpoint { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _virtualEndpointPropertiesDeserializer(item["properties"])), + }; +} + +/** Properties of a pair of virtual endpoints. */ +export interface VirtualEndpointResourceProperties { + /** Type of endpoint for the virtual endpoints. */ + endpointType?: VirtualEndpointType; + /** List of servers that one of the virtual endpoints can refer to. */ + members?: string[]; + /** List of virtual endpoints for a server. */ + readonly virtualEndpoints?: string[]; +} + +export function virtualEndpointResourcePropertiesSerializer( + item: VirtualEndpointResourceProperties, +): any { + return { + endpointType: item["endpointType"], + members: !item["members"] + ? item["members"] + : item["members"].map((p: any) => { + return p; + }), + }; +} + +export function virtualEndpointResourcePropertiesDeserializer( + item: any, +): VirtualEndpointResourceProperties { + return { + endpointType: item["endpointType"], + members: !item["members"] + ? item["members"] + : item["members"].map((p: any) => { + return p; + }), + virtualEndpoints: !item["virtualEndpoints"] + ? item["virtualEndpoints"] + : item["virtualEndpoints"].map((p: any) => { + return p; + }), + }; +} + +/** Type of endpoint for the virtual endpoints. */ +export enum KnownVirtualEndpointType { + /** ReadWrite */ + ReadWrite = "ReadWrite", +} + +/** + * Type of endpoint for the virtual endpoints. \ + * {@link KnownVirtualEndpointType} can be used interchangeably with VirtualEndpointType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ReadWrite** + */ +export type VirtualEndpointType = string; + +/** Pair of virtual endpoints for a server. */ +export interface VirtualEndpointResourceForPatch { + /** Type of endpoint for the virtual endpoints. */ + endpointType?: VirtualEndpointType; + /** List of servers that one of the virtual endpoints can refer to. */ + members?: string[]; + /** List of virtual endpoints for a server. */ + readonly virtualEndpoints?: string[]; +} + +export function virtualEndpointResourceForPatchSerializer( + item: VirtualEndpointResourceForPatch, +): any { + return { + properties: areAllPropsUndefined(item, ["endpointType", "members"]) + ? undefined + : _virtualEndpointResourceForPatchPropertiesSerializer(item), + }; +} + +/** List of virtual endpoints. */ +export interface _VirtualEndpointsList { + /** The VirtualEndpoint items on this page */ + value: VirtualEndpoint[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _virtualEndpointsListDeserializer(item: any): _VirtualEndpointsList { + return { + value: virtualEndpointArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function virtualEndpointArraySerializer(result: Array): any[] { + return result.map((item) => { + return virtualEndpointSerializer(item); + }); +} + +export function virtualEndpointArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return virtualEndpointDeserializer(item); + }); +} + +/** Server administrator associated to a Microsoft Entra principal. */ +export interface AdministratorMicrosoftEntra extends ProxyResource { + /** Type of Microsoft Entra principal to which the server administrator is associated. */ + principalType?: PrincipalType; + /** Name of the Microsoft Entra principal. */ + principalName?: string; + /** Object identifier of the Microsoft Entra principal. */ + objectId?: string; + /** Identifier of the tenant in which the Microsoft Entra principal exists. */ + tenantId?: string; +} + +export function administratorMicrosoftEntraDeserializer(item: any): AdministratorMicrosoftEntra { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ..._administratorMicrosoftEntraPropertiesDeserializer(item["properties"]), + }; +} + +/** Properties of a server administrator associated to a Microsoft Entra principal. */ +export interface AdministratorMicrosoftEntraProperties { + /** Type of Microsoft Entra principal to which the server administrator is associated. */ + principalType?: PrincipalType; + /** Name of the Microsoft Entra principal. */ + principalName?: string; + /** Object identifier of the Microsoft Entra principal. */ + objectId?: string; + /** Identifier of the tenant in which the Microsoft Entra principal exists. */ + tenantId?: string; +} + +export function administratorMicrosoftEntraPropertiesDeserializer( + item: any, +): AdministratorMicrosoftEntraProperties { + return { + principalType: item["principalType"], + principalName: item["principalName"], + objectId: item["objectId"], + tenantId: item["tenantId"], + }; +} + +/** Type of Microsoft Entra principal to which the server administrator is associated. */ +export enum KnownPrincipalType { + /** The principal type is not known or not specified. */ + Unknown = "Unknown", + /** A Microsoft Entra user. */ + User = "User", + /** A Microsoft Entra group. */ + Group = "Group", + /** A Microsoft Entra service principal, typically representing an application or service identity */ + ServicePrincipal = "ServicePrincipal", +} + +/** + * Type of Microsoft Entra principal to which the server administrator is associated. \ + * {@link KnownPrincipalType} can be used interchangeably with PrincipalType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown**: The principal type is not known or not specified. \ + * **User**: A Microsoft Entra user. \ + * **Group**: A Microsoft Entra group. \ + * **ServicePrincipal**: A Microsoft Entra service principal, typically representing an application or service identity + */ +export type PrincipalType = string; + +/** Server administrator associated to a Microsoft Entra principal. */ +export interface AdministratorMicrosoftEntraAdd { + /** Type of Microsoft Entra principal to which the server administrator is associated. */ + principalType?: PrincipalType; + /** Name of the Microsoft Entra principal. */ + principalName?: string; + /** Identifier of the tenant in which the Microsoft Entra principal exists. */ + tenantId?: string; +} + +export function administratorMicrosoftEntraAddSerializer( + item: AdministratorMicrosoftEntraAdd, +): any { + return { + properties: areAllPropsUndefined(item, ["principalType", "principalName", "tenantId"]) + ? undefined + : _administratorMicrosoftEntraAddPropertiesSerializer(item), + }; +} + +/** Properties of a server administrator associated to a Microsoft Entra principal. */ +export interface AdministratorMicrosoftEntraPropertiesForAdd { + /** Type of Microsoft Entra principal to which the server administrator is associated. */ + principalType?: PrincipalType; + /** Name of the Microsoft Entra principal. */ + principalName?: string; + /** Identifier of the tenant in which the Microsoft Entra principal exists. */ + tenantId?: string; +} + +export function administratorMicrosoftEntraPropertiesForAddSerializer( + item: AdministratorMicrosoftEntraPropertiesForAdd, +): any { + return { + principalType: item["principalType"], + principalName: item["principalName"], + tenantId: item["tenantId"], + }; +} + +/** List of server administrators associated to Microsoft Entra principals. */ +export interface _AdministratorMicrosoftEntraList { + /** The AdministratorMicrosoftEntra items on this page */ + value: AdministratorMicrosoftEntra[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _administratorMicrosoftEntraListDeserializer( + item: any, +): _AdministratorMicrosoftEntraList { + return { + value: administratorMicrosoftEntraArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function administratorMicrosoftEntraArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return administratorMicrosoftEntraDeserializer(item); + }); +} + +/** List of capabilities for the Azure Database for PostgreSQL flexible server. */ +export interface _CapabilityList { + /** The Capability items on this page */ + readonly value: Capability[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _capabilityListDeserializer(item: any): _CapabilityList { + return { + value: capabilityArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function capabilityArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return capabilityDeserializer(item); + }); +} + +/** Capability for the Azure Database for PostgreSQL flexible server. */ +export interface Capability extends CapabilityBase { + /** Name of flexible servers capabilities. */ + name?: string; + /** List of supported compute tiers. */ + readonly supportedServerEditions?: ServerEditionCapability[]; + /** List of supported major versions of PostgreSQL database engine. */ + readonly supportedServerVersions?: ServerVersionCapability[]; + /** Features supported. */ + readonly supportedFeatures?: SupportedFeature[]; + /** Indicates if fast provisioning is supported. 'Enabled' means fast provisioning is supported. 'Disabled' stands for fast provisioning is not supported. Will be deprecated in the future. Look to Supported Features for 'FastProvisioning'. */ + readonly fastProvisioningSupported?: FastProvisioningSupport; + /** List of compute tiers supporting fast provisioning. */ + readonly supportedFastProvisioningEditions?: FastProvisioningEditionCapability[]; + /** Indicates if geographically redundant backups are supported in this location. 'Enabled' means geographically redundant backups are supported. 'Disabled' stands for geographically redundant backup is not supported. Will be deprecated in the future. Look to Supported Features for 'GeoBackup'. */ + readonly geoBackupSupported?: GeographicallyRedundantBackupSupport; + /** Indicates if high availability with zone redundancy is supported in this location. 'Enabled' means high availability with zone redundancy is supported. 'Disabled' stands for high availability with zone redundancy is not supported. Will be deprecated in the future. Look to Supported Features for 'ZoneRedundantHa'. */ + readonly zoneRedundantHaSupported?: ZoneRedundantHighAvailabilitySupport; + /** Indicates if high availability with zone redundancy is supported in conjunction with geographically redundant backups in this location. 'Enabled' means high availability with zone redundancy is supported in conjunction with geographically redundant backups is supported. 'Disabled' stands for high availability with zone redundancy is supported in conjunction with geographically redundant backups is not supported. Will be deprecated in the future. Look to Supported Features for 'ZoneRedundantHaAndGeoBackup'. */ + readonly zoneRedundantHaAndGeoBackupSupported?: ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport; + /** Indicates if storage autogrow is supported in this location. 'Enabled' means storage autogrow is supported. 'Disabled' stands for storage autogrow is not supported. Will be deprecated in the future. Look to Supported Features for 'StorageAutoGrowth'. */ + readonly storageAutoGrowthSupported?: StorageAutoGrowthSupport; + /** Indicates if resizing the storage, without interrupting the operation of the database engine, is supported in this location for the given subscription. 'Enabled' means resizing the storage without interrupting the operation of the database engine is supported. 'Disabled' means resizing the storage without interrupting the operation of the database engine is not supported. Will be deprecated in the future. Look to Supported Features for 'OnlineResize'. */ + readonly onlineResizeSupported?: OnlineStorageResizeSupport; + /** Indicates if this location is restricted. 'Enabled' means location is restricted. 'Disabled' stands for location is not restricted. Will be deprecated in the future. Look to Supported Features for 'Restricted'. */ + readonly restricted?: LocationRestricted; +} + +export function capabilityDeserializer(item: any): Capability { + return { + status: item["status"], + reason: item["reason"], + name: item["name"], + supportedServerEditions: !item["supportedServerEditions"] + ? item["supportedServerEditions"] + : serverEditionCapabilityArrayDeserializer(item["supportedServerEditions"]), + supportedServerVersions: !item["supportedServerVersions"] + ? item["supportedServerVersions"] + : serverVersionCapabilityArrayDeserializer(item["supportedServerVersions"]), + supportedFeatures: !item["supportedFeatures"] + ? item["supportedFeatures"] + : supportedFeatureArrayDeserializer(item["supportedFeatures"]), + fastProvisioningSupported: item["fastProvisioningSupported"], + supportedFastProvisioningEditions: !item["supportedFastProvisioningEditions"] + ? item["supportedFastProvisioningEditions"] + : fastProvisioningEditionCapabilityArrayDeserializer( + item["supportedFastProvisioningEditions"], + ), + geoBackupSupported: item["geoBackupSupported"], + zoneRedundantHaSupported: item["zoneRedundantHaSupported"], + zoneRedundantHaAndGeoBackupSupported: item["zoneRedundantHaAndGeoBackupSupported"], + storageAutoGrowthSupported: item["storageAutoGrowthSupported"], + onlineResizeSupported: item["onlineResizeSupported"], + restricted: item["restricted"], + }; +} + +export function serverEditionCapabilityArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return serverEditionCapabilityDeserializer(item); + }); +} + +/** Capabilities in terms of compute tier. */ +export interface ServerEditionCapability extends CapabilityBase { + /** Name of compute tier. */ + readonly name?: string; + /** Default compute name (SKU) for this computer tier. */ + readonly defaultSkuName?: string; + /** List of storage editions supported by this compute tier and compute name. */ + readonly supportedStorageEditions?: StorageEditionCapability[]; + /** List of supported compute names (SKUs). */ + readonly supportedServerSkus?: ServerSkuCapability[]; +} + +export function serverEditionCapabilityDeserializer(item: any): ServerEditionCapability { + return { + status: item["status"], + reason: item["reason"], + name: item["name"], + defaultSkuName: item["defaultSkuName"], + supportedStorageEditions: !item["supportedStorageEditions"] + ? item["supportedStorageEditions"] + : storageEditionCapabilityArrayDeserializer(item["supportedStorageEditions"]), + supportedServerSkus: !item["supportedServerSkus"] + ? item["supportedServerSkus"] + : serverSkuCapabilityArrayDeserializer(item["supportedServerSkus"]), + }; +} + +export function storageEditionCapabilityArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return storageEditionCapabilityDeserializer(item); + }); +} + +/** Capabilities in terms of storage tier. */ +export interface StorageEditionCapability extends CapabilityBase { + /** Name of storage tier. */ + readonly name?: string; + /** Default storage size (in MB) for this storage tier. */ + readonly defaultStorageSizeMb?: number; + /** Configurations of storage supported for this storage tier. */ + readonly supportedStorageMb?: StorageMbCapability[]; +} + +export function storageEditionCapabilityDeserializer(item: any): StorageEditionCapability { + return { + status: item["status"], + reason: item["reason"], + name: item["name"], + defaultStorageSizeMb: item["defaultStorageSizeMb"], + supportedStorageMb: !item["supportedStorageMb"] + ? item["supportedStorageMb"] + : storageMbCapabilityArrayDeserializer(item["supportedStorageMb"]), + }; +} + +export function storageMbCapabilityArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return storageMbCapabilityDeserializer(item); + }); +} + +/** Storage size (in MB) capability. */ +export interface StorageMbCapability extends CapabilityBase { + /** Minimum IOPS supported by the storage size. */ + readonly supportedIops?: number; + /** Maximum IOPS supported by the storage size. */ + readonly supportedMaximumIops?: number; + /** Minimum supported size (in MB) of storage. */ + readonly storageSizeMb?: number; + /** Maximum supported size (in MB) of storage. */ + readonly maximumStorageSizeMb?: number; + /** Minimum supported throughput (in MB/s) of storage. */ + readonly supportedThroughput?: number; + /** Maximum supported throughput (in MB/s) of storage. */ + readonly supportedMaximumThroughput?: number; + /** Default IOPS for this tier and storage size. */ + readonly defaultIopsTier?: string; + /** List of all supported storage tiers for this tier and storage size. */ + readonly supportedIopsTiers?: StorageTierCapability[]; +} + +export function storageMbCapabilityDeserializer(item: any): StorageMbCapability { + return { + status: item["status"], + reason: item["reason"], + supportedIops: item["supportedIops"], + supportedMaximumIops: item["supportedMaximumIops"], + storageSizeMb: item["storageSizeMb"], + maximumStorageSizeMb: item["maximumStorageSizeMb"], + supportedThroughput: item["supportedThroughput"], + supportedMaximumThroughput: item["supportedMaximumThroughput"], + defaultIopsTier: item["defaultIopsTier"], + supportedIopsTiers: !item["supportedIopsTiers"] + ? item["supportedIopsTiers"] + : storageTierCapabilityArrayDeserializer(item["supportedIopsTiers"]), + }; +} + +export function storageTierCapabilityArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return storageTierCapabilityDeserializer(item); + }); +} + +/** Capability of a storage tier. */ +export interface StorageTierCapability extends CapabilityBase { + /** Name of the storage tier. */ + readonly name?: string; + /** Supported IOPS for the storage tier. */ + readonly iops?: number; +} + +export function storageTierCapabilityDeserializer(item: any): StorageTierCapability { + return { + status: item["status"], + reason: item["reason"], + name: item["name"], + iops: item["iops"], + }; +} + +export function serverSkuCapabilityArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return serverSkuCapabilityDeserializer(item); + }); +} + +/** Capabilities in terms of compute. */ +export interface ServerSkuCapability extends CapabilityBase { + /** Name of the compute (SKU). */ + readonly name?: string; + /** vCores available for this compute. */ + readonly vCores?: number; + /** Maximum IOPS supported by this compute. */ + readonly supportedIops?: number; + /** Supported memory (in MB) per virtual core assigned to this compute. */ + readonly supportedMemoryPerVcoreMb?: number; + /** List of supported availability zones. E.g. '1', '2', '3' */ + readonly supportedZones?: string[]; + /** Modes of high availability supported for this compute. */ + readonly supportedHaMode?: HighAvailabilityMode[]; + /** Features supported. */ + readonly supportedFeatures?: SupportedFeature[]; + /** Security profile of the compute. Indicates if it's a Confidential Compute virtual machine. */ + readonly securityProfile?: string; +} + +export function serverSkuCapabilityDeserializer(item: any): ServerSkuCapability { + return { + status: item["status"], + reason: item["reason"], + name: item["name"], + vCores: item["vCores"], + supportedIops: item["supportedIops"], + supportedMemoryPerVcoreMb: item["supportedMemoryPerVcoreMb"], + supportedZones: !item["supportedZones"] + ? item["supportedZones"] + : item["supportedZones"].map((p: any) => { + return p; + }), + supportedHaMode: !item["supportedHaMode"] + ? item["supportedHaMode"] + : item["supportedHaMode"].map((p: any) => { + return p; + }), + supportedFeatures: !item["supportedFeatures"] + ? item["supportedFeatures"] + : supportedFeatureArrayDeserializer(item["supportedFeatures"]), + securityProfile: item["securityProfile"], + }; +} + +/** Modes of high availability supported for this compute. */ +export enum KnownHighAvailabilityMode { + /** ZoneRedundant */ + ZoneRedundant = "ZoneRedundant", + /** SameZone */ + SameZone = "SameZone", +} + +/** + * Modes of high availability supported for this compute. \ + * {@link KnownHighAvailabilityMode} can be used interchangeably with HighAvailabilityMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ZoneRedundant** \ + * **SameZone** + */ +export type HighAvailabilityMode = string; + +export function supportedFeatureArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return supportedFeatureDeserializer(item); + }); +} + +/** Features supported. */ +export interface SupportedFeature { + /** Name of the feature. */ + readonly name?: string; + /** Status of the feature. Indicates if the feature is enabled or not. */ + readonly status?: FeatureStatus; +} + +export function supportedFeatureDeserializer(item: any): SupportedFeature { + return { + name: item["name"], + status: item["status"], + }; +} + +/** Status of the feature. Indicates if the feature is enabled or not. */ +export enum KnownFeatureStatus { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Status of the feature. Indicates if the feature is enabled or not. \ + * {@link KnownFeatureStatus} can be used interchangeably with FeatureStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type FeatureStatus = string; + +export function serverVersionCapabilityArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return serverVersionCapabilityDeserializer(item); + }); +} + +/** Capabilities in terms of major versions of PostgreSQL database engine. */ +export interface ServerVersionCapability extends CapabilityBase { + /** Major version of PostgreSQL database engine. */ + readonly name?: string; + /** Major versions of PostgreSQL database engine to which this version can be automatically upgraded. */ + readonly supportedVersionsToUpgrade?: string[]; + /** Features supported. */ + readonly supportedFeatures?: SupportedFeature[]; +} + +export function serverVersionCapabilityDeserializer(item: any): ServerVersionCapability { + return { + status: item["status"], + reason: item["reason"], + name: item["name"], + supportedVersionsToUpgrade: !item["supportedVersionsToUpgrade"] + ? item["supportedVersionsToUpgrade"] + : item["supportedVersionsToUpgrade"].map((p: any) => { + return p; + }), + supportedFeatures: !item["supportedFeatures"] + ? item["supportedFeatures"] + : supportedFeatureArrayDeserializer(item["supportedFeatures"]), + }; +} + +/** Indicates if fast provisioning is supported. 'Enabled' means fast provisioning is supported. 'Disabled' stands for fast provisioning is not supported. Will be deprecated in the future. Look to Supported Features for 'FastProvisioning'. */ +export enum KnownFastProvisioningSupport { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if fast provisioning is supported. 'Enabled' means fast provisioning is supported. 'Disabled' stands for fast provisioning is not supported. Will be deprecated in the future. Look to Supported Features for 'FastProvisioning'. \ + * {@link KnownFastProvisioningSupport} can be used interchangeably with FastProvisioningSupport, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type FastProvisioningSupport = string; + +export function fastProvisioningEditionCapabilityArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return fastProvisioningEditionCapabilityDeserializer(item); + }); +} + +/** Capability of a fast provisioning compute tier. */ +export interface FastProvisioningEditionCapability extends CapabilityBase { + /** Compute tier supporting fast provisioning. */ + readonly supportedTier?: string; + /** Compute name (SKU) supporting fast provisioning. */ + readonly supportedSku?: string; + /** Storage size (in GB) supporting fast provisioning. */ + readonly supportedStorageGb?: number; + /** Major version of PostgreSQL database engine supporting fast provisioning. */ + readonly supportedServerVersions?: string; + /** Count of servers in cache matching this specification. */ + readonly serverCount?: number; +} + +export function fastProvisioningEditionCapabilityDeserializer( + item: any, +): FastProvisioningEditionCapability { + return { + status: item["status"], + reason: item["reason"], + supportedTier: item["supportedTier"], + supportedSku: item["supportedSku"], + supportedStorageGb: item["supportedStorageGb"], + supportedServerVersions: item["supportedServerVersions"], + serverCount: item["serverCount"], + }; +} + +/** Indicates if geographically redundant backups are supported in this location. 'Enabled' means geographically redundant backups are supported. 'Disabled' stands for geographically redundant backup is not supported. Will be deprecated in the future. Look to Supported Features for 'GeoBackup'. */ +export enum KnownGeographicallyRedundantBackupSupport { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if geographically redundant backups are supported in this location. 'Enabled' means geographically redundant backups are supported. 'Disabled' stands for geographically redundant backup is not supported. Will be deprecated in the future. Look to Supported Features for 'GeoBackup'. \ + * {@link KnownGeographicallyRedundantBackupSupport} can be used interchangeably with GeographicallyRedundantBackupSupport, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type GeographicallyRedundantBackupSupport = string; + +/** Indicates if high availability with zone redundancy is supported in this location. 'Enabled' means high availability with zone redundancy is supported. 'Disabled' stands for high availability with zone redundancy is not supported. Will be deprecated in the future. Look to Supported Features for 'ZoneRedundantHa'. */ +export enum KnownZoneRedundantHighAvailabilitySupport { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if high availability with zone redundancy is supported in this location. 'Enabled' means high availability with zone redundancy is supported. 'Disabled' stands for high availability with zone redundancy is not supported. Will be deprecated in the future. Look to Supported Features for 'ZoneRedundantHa'. \ + * {@link KnownZoneRedundantHighAvailabilitySupport} can be used interchangeably with ZoneRedundantHighAvailabilitySupport, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type ZoneRedundantHighAvailabilitySupport = string; + +/** Indicates if high availability with zone redundancy is supported in conjunction with geographically redundant backups in this location. 'Enabled' means high availability with zone redundancy is supported in conjunction with geographically redundant backups is supported. 'Disabled' stands for high availability with zone redundancy is supported in conjunction with geographically redundant backups is not supported. Will be deprecated in the future. Look to Supported Features for 'ZoneRedundantHaAndGeoBackup'. */ +export enum KnownZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if high availability with zone redundancy is supported in conjunction with geographically redundant backups in this location. 'Enabled' means high availability with zone redundancy is supported in conjunction with geographically redundant backups is supported. 'Disabled' stands for high availability with zone redundancy is supported in conjunction with geographically redundant backups is not supported. Will be deprecated in the future. Look to Supported Features for 'ZoneRedundantHaAndGeoBackup'. \ + * {@link KnownZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport} can be used interchangeably with ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport = string; + +/** Indicates if storage autogrow is supported in this location. 'Enabled' means storage autogrow is supported. 'Disabled' stands for storage autogrow is not supported. Will be deprecated in the future. Look to Supported Features for 'StorageAutoGrowth'. */ +export enum KnownStorageAutoGrowthSupport { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if storage autogrow is supported in this location. 'Enabled' means storage autogrow is supported. 'Disabled' stands for storage autogrow is not supported. Will be deprecated in the future. Look to Supported Features for 'StorageAutoGrowth'. \ + * {@link KnownStorageAutoGrowthSupport} can be used interchangeably with StorageAutoGrowthSupport, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type StorageAutoGrowthSupport = string; + +/** Indicates if resizing the storage, without interrupting the operation of the database engine, is supported in this location for the given subscription. 'Enabled' means resizing the storage without interrupting the operation of the database engine is supported. 'Disabled' means resizing the storage without interrupting the operation of the database engine is not supported. Will be deprecated in the future. Look to Supported Features for 'OnlineResize'. */ +export enum KnownOnlineStorageResizeSupport { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if resizing the storage, without interrupting the operation of the database engine, is supported in this location for the given subscription. 'Enabled' means resizing the storage without interrupting the operation of the database engine is supported. 'Disabled' means resizing the storage without interrupting the operation of the database engine is not supported. Will be deprecated in the future. Look to Supported Features for 'OnlineResize'. \ + * {@link KnownOnlineStorageResizeSupport} can be used interchangeably with OnlineStorageResizeSupport, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type OnlineStorageResizeSupport = string; + +/** Indicates if this location is restricted. 'Enabled' means location is restricted. 'Disabled' stands for location is not restricted. Will be deprecated in the future. Look to Supported Features for 'Restricted'. */ +export enum KnownLocationRestricted { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Indicates if this location is restricted. 'Enabled' means location is restricted. 'Disabled' stands for location is not restricted. Will be deprecated in the future. Look to Supported Features for 'Restricted'. \ + * {@link KnownLocationRestricted} can be used interchangeably with LocationRestricted, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type LocationRestricted = string; + +/** Base object for representing capability */ +export interface CapabilityBase { + /** The status of the capability. */ + readonly status?: CapabilityStatus; + /** The reason for the capability not being available. */ + readonly reason?: string; +} + +export function capabilityBaseDeserializer(item: any): CapabilityBase { + return { + status: item["status"], + reason: item["reason"], + }; +} + +/** The status of the capability. */ +export type CapabilityStatus = "Visible" | "Available" | "Default" | "Disabled"; + +/** List of log files. */ +export interface _CapturedLogList { + /** The CapturedLog items on this page */ + value: CapturedLog[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _capturedLogListDeserializer(item: any): _CapturedLogList { + return { + value: capturedLogArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function capturedLogArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return capturedLogDeserializer(item); + }); +} + +/** Log file. */ +export interface CapturedLog extends ProxyResource { + /** Creation timestamp of the log file. */ + createdTime?: Date; + /** Last modified timestamp of the log file. */ + lastModifiedTime?: Date; + /** Size (in KB) of the log file. */ + sizeInKb?: number; + /** Type of log file. Can be 'ServerLogs' or 'UpgradeLogs'. */ + typePropertiesType?: string; + /** URL to download the log file from. */ + url?: string; +} + +export function capturedLogDeserializer(item: any): CapturedLog { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _capturedLogPropertiesDeserializer(item["properties"])), + }; +} + +/** Properties of a log file. */ +export interface CapturedLogProperties { + /** Creation timestamp of the log file. */ + createdTime?: Date; + /** Last modified timestamp of the log file. */ + lastModifiedTime?: Date; + /** Size (in KB) of the log file. */ + sizeInKb?: number; + /** Type of log file. Can be 'ServerLogs' or 'UpgradeLogs'. */ + type?: string; + /** URL to download the log file from. */ + url?: string; +} + +export function capturedLogPropertiesDeserializer(item: any): CapturedLogProperties { + return { + createdTime: !item["createdTime"] ? item["createdTime"] : new Date(item["createdTime"]), + lastModifiedTime: !item["lastModifiedTime"] + ? item["lastModifiedTime"] + : new Date(item["lastModifiedTime"]), + sizeInKb: item["sizeInKb"], + type: item["type"], + url: item["url"], + }; +} + +/** A request that is made for pre-backup. */ +export interface LtrPreBackupRequest extends BackupRequestBase {} + +export function ltrPreBackupRequestSerializer(item: LtrPreBackupRequest): any { + return { backupSettings: backupSettingsSerializer(item["backupSettings"]) }; +} + +/** BackupRequestBase is the base for all backup request. */ +export interface BackupRequestBase { + /** Backup Settings */ + backupSettings: BackupSettings; +} + +export function backupRequestBaseSerializer(item: BackupRequestBase): any { + return { backupSettings: backupSettingsSerializer(item["backupSettings"]) }; +} + +/** The settings for the long term backup. */ +export interface BackupSettings { + /** Backup Name for the current backup */ + backupName: string; +} + +export function backupSettingsSerializer(item: BackupSettings): any { + return { backupName: item["backupName"] }; +} + +/** Response for the LTR pre-backup API call */ +export interface LtrPreBackupResponse { + /** Number of storage containers the plugin will use during backup. More than one containers may be used for size limitations, parallelism, or redundancy etc. */ + numberOfContainers: number; +} + +export function ltrPreBackupResponseDeserializer(item: any): LtrPreBackupResponse { + return { + ..._ltrPreBackupResponsePropertiesDeserializer(item["properties"]), + }; +} + +/** Response for the pre-backup request. */ +export interface BackupsLongTermRetentionResponseProperties { + /** Number of storage containers the plugin will use during backup. More than one containers may be used for size limitations, parallelism, or redundancy etc. */ + numberOfContainers: number; +} + +export function backupsLongTermRetentionResponsePropertiesDeserializer( + item: any, +): BackupsLongTermRetentionResponseProperties { + return { + numberOfContainers: item["numberOfContainers"], + }; +} + +/** The request that is made for a long term retention backup. */ +export interface BackupsLongTermRetentionRequest extends BackupRequestBase { + /** Backup store detail for target server */ + targetDetails: BackupStoreDetails; +} + +export function backupsLongTermRetentionRequestSerializer( + item: BackupsLongTermRetentionRequest, +): any { + return { + backupSettings: backupSettingsSerializer(item["backupSettings"]), + targetDetails: backupStoreDetailsSerializer(item["targetDetails"]), + }; +} + +/** Details about the target where the backup content will be stored. */ +export interface BackupStoreDetails { + /** List of SAS uri of storage containers where backup data is to be streamed/copied. */ + sasUriList: string[]; +} + +export function backupStoreDetailsSerializer(item: BackupStoreDetails): any { + return { + sasUriList: item["sasUriList"].map((p: any) => { + return p; + }), + }; +} + +/** Response for the LTR backup API call */ +export interface BackupsLongTermRetentionResponse { + /** Size of datasource in bytes */ + datasourceSizeInBytes?: number; + /** Data transferred in bytes */ + dataTransferredInBytes?: number; + /** Name of Backup operation */ + backupName?: string; + /** Metadata to be stored in RP. Store everything that will be required to perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc */ + backupMetadata?: string; + /** Service-set extensible enum indicating the status of operation */ + status?: ExecutionStatus; + /** Start time of the operation. */ + startTime?: Date; + /** End time of the operation. */ + endTime?: Date; + /** PercentageCompleted */ + percentComplete?: number; + /** The error code. */ + readonly errorCode?: string; + /** The error message. */ + readonly errorMessage?: string; +} + +export function backupsLongTermRetentionResponseDeserializer( + item: any, +): BackupsLongTermRetentionResponse { + return { + ...(!item["properties"] + ? item["properties"] + : _backupsLongTermRetentionResponsePropertiesDeserializer(item["properties"])), + }; +} + +/** Response for the backup request. */ +export interface LtrBackupOperationResponseProperties { + /** Size of datasource in bytes */ + datasourceSizeInBytes?: number; + /** Data transferred in bytes */ + dataTransferredInBytes?: number; + /** Name of Backup operation */ + backupName?: string; + /** Metadata to be stored in RP. Store everything that will be required to perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc */ + backupMetadata?: string; + /** Service-set extensible enum indicating the status of operation */ + status: ExecutionStatus; + /** Start time of the operation. */ + startTime: Date; + /** End time of the operation. */ + endTime?: Date; + /** PercentageCompleted */ + percentComplete?: number; + /** The error code. */ + readonly errorCode?: string; + /** The error message. */ + readonly errorMessage?: string; +} + +export function ltrBackupOperationResponsePropertiesDeserializer( + item: any, +): LtrBackupOperationResponseProperties { + return { + datasourceSizeInBytes: item["datasourceSizeInBytes"], + dataTransferredInBytes: item["dataTransferredInBytes"], + backupName: item["backupName"], + backupMetadata: item["backupMetadata"], + status: item["status"], + startTime: new Date(item["startTime"]), + endTime: !item["endTime"] ? item["endTime"] : new Date(item["endTime"]), + percentComplete: item["percentComplete"], + errorCode: item["errorCode"], + errorMessage: item["errorMessage"], + }; +} + +/** Service-set extensible enum indicating the status of operation */ +export enum KnownExecutionStatus { + /** Running */ + Running = "Running", + /** Cancelled */ + Cancelled = "Cancelled", + /** Failed */ + Failed = "Failed", + /** Succeeded */ + Succeeded = "Succeeded", +} + +/** + * Service-set extensible enum indicating the status of operation \ + * {@link KnownExecutionStatus} can be used interchangeably with ExecutionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Running** \ + * **Cancelled** \ + * **Failed** \ + * **Succeeded** + */ +export type ExecutionStatus = string; + +/** Response for the LTR backup Operation API call */ +export interface BackupsLongTermRetentionOperation extends ProxyResource { + /** Size of datasource in bytes */ + datasourceSizeInBytes?: number; + /** Data transferred in bytes */ + dataTransferredInBytes?: number; + /** Name of Backup operation */ + backupName?: string; + /** Metadata to be stored in RP. Store everything that will be required to perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc */ + backupMetadata?: string; + /** Service-set extensible enum indicating the status of operation */ + status?: ExecutionStatus; + /** Start time of the operation. */ + startTime?: Date; + /** End time of the operation. */ + endTime?: Date; + /** PercentageCompleted */ + percentComplete?: number; + /** The error code. */ + readonly errorCode?: string; + /** The error message. */ + readonly errorMessage?: string; +} + +export function backupsLongTermRetentionOperationDeserializer( + item: any, +): BackupsLongTermRetentionOperation { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _backupsLongTermRetentionOperationPropertiesDeserializer(item["properties"])), + }; +} + +/** A list of long term retention backup operations for server. */ +export interface _LtrServerBackupOperationList { + /** The BackupsLongTermRetentionOperation items on this page */ + value: BackupsLongTermRetentionOperation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _ltrServerBackupOperationListDeserializer( + item: any, +): _LtrServerBackupOperationList { + return { + value: backupsLongTermRetentionOperationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function backupsLongTermRetentionOperationArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return backupsLongTermRetentionOperationDeserializer(item); + }); +} + +/** Advanced threat protection settings of the server. */ +export interface AdvancedThreatProtectionSettingsModel extends ProxyResource { + /** Specifies the state of the advanced threat protection, whether it is enabled, disabled, or a state has not been applied yet on the server. */ + state?: ThreatProtectionState; + /** Specifies the creation time (UTC) of the policy. */ + readonly creationTime?: Date; +} + +export function advancedThreatProtectionSettingsModelSerializer( + item: AdvancedThreatProtectionSettingsModel, +): any { + return { + properties: areAllPropsUndefined(item, ["state"]) + ? undefined + : _advancedThreatProtectionSettingsModelPropertiesSerializer(item), + }; +} + +export function advancedThreatProtectionSettingsModelDeserializer( + item: any, +): AdvancedThreatProtectionSettingsModel { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _advancedThreatProtectionSettingsModelPropertiesDeserializer(item["properties"])), + }; +} + +/** Properties of advanced threat protection state for a server. */ +export interface AdvancedThreatProtectionSettingsProperties { + /** Specifies the state of the advanced threat protection, whether it is enabled, disabled, or a state has not been applied yet on the server. */ + state: ThreatProtectionState; + /** Specifies the creation time (UTC) of the policy. */ + readonly creationTime?: Date; +} + +export function advancedThreatProtectionSettingsPropertiesSerializer( + item: AdvancedThreatProtectionSettingsProperties, +): any { + return { state: item["state"] }; +} + +export function advancedThreatProtectionSettingsPropertiesDeserializer( + item: any, +): AdvancedThreatProtectionSettingsProperties { + return { + state: item["state"], + creationTime: !item["creationTime"] ? item["creationTime"] : new Date(item["creationTime"]), + }; +} + +/** Specifies the state of the advanced threat protection, whether it is enabled, disabled, or a state has not been applied yet on the server. */ +export type ThreatProtectionState = "Enabled" | "Disabled"; + +/** Known values of {@link ThreatProtectionName} that the service accepts. */ +export enum KnownThreatProtectionName { + /** Default */ + Default = "Default", +} + +/** Type of ThreatProtectionName */ +export type ThreatProtectionName = string; + +/** List of advanced threat protection settings for a server. */ +export interface _AdvancedThreatProtectionSettingsList { + /** The AdvancedThreatProtectionSettingsModel items on this page */ + readonly value: AdvancedThreatProtectionSettingsModel[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _advancedThreatProtectionSettingsListDeserializer( + item: any, +): _AdvancedThreatProtectionSettingsList { + return { + value: advancedThreatProtectionSettingsModelArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function advancedThreatProtectionSettingsModelArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return advancedThreatProtectionSettingsModelSerializer(item); + }); +} + +export function advancedThreatProtectionSettingsModelArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return advancedThreatProtectionSettingsModelDeserializer(item); + }); +} + +/** Properties of a backup. */ +export interface BackupAutomaticAndOnDemand extends ProxyResource { + /** Type of backup. */ + backupType?: BackupType; + /** Time(ISO8601 format) at which the backup was completed. */ + completedTime?: Date; + /** Source of the backup. */ + source?: string; +} + +export function backupAutomaticAndOnDemandDeserializer(item: any): BackupAutomaticAndOnDemand { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : _backupAutomaticAndOnDemandPropertiesDeserializer(item["properties"])), + }; +} + +/** Properties of a backup. */ +export interface BackupAutomaticAndOnDemandProperties { + /** Type of backup. */ + backupType?: BackupType; + /** Time(ISO8601 format) at which the backup was completed. */ + completedTime?: Date; + /** Source of the backup. */ + source?: string; +} + +export function backupAutomaticAndOnDemandPropertiesDeserializer( + item: any, +): BackupAutomaticAndOnDemandProperties { + return { + backupType: item["backupType"], + completedTime: !item["completedTime"] ? item["completedTime"] : new Date(item["completedTime"]), + source: item["source"], + }; +} + +/** Type of backup. */ +export enum KnownBackupType { + /** Full */ + Full = "Full", + /** Customer On-Demand */ + CustomerOnDemand = "Customer On-Demand", +} + +/** + * Type of backup. \ + * {@link KnownBackupType} can be used interchangeably with BackupType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Full** \ + * **Customer On-Demand** + */ +export type BackupType = string; + +/** List of backups. */ +export interface _BackupAutomaticAndOnDemandList { + /** The BackupAutomaticAndOnDemand items on this page */ + value: BackupAutomaticAndOnDemand[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _backupAutomaticAndOnDemandListDeserializer( + item: any, +): _BackupAutomaticAndOnDemandList { + return { + value: backupAutomaticAndOnDemandArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function backupAutomaticAndOnDemandArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return backupAutomaticAndOnDemandDeserializer(item); + }); +} + +/** Impact on some metric if this recommended action is applied. */ +export interface TuningOptions extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: TuningOptionsProperties; +} + +export function tuningOptionsDeserializer(item: any): TuningOptions { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : tuningOptionsPropertiesDeserializer(item["properties"]), + }; +} + +/** Properties of a tuning option. */ +export interface TuningOptionsProperties { + /** State of the tuning option. */ + readonly state?: string; +} + +export function tuningOptionsPropertiesDeserializer(item: any): TuningOptionsProperties { + return { + state: item["state"], + }; +} + +/** The name of the tuning option. */ +export enum KnownTuningOptionParameterEnum { + /** index */ + Index = "index", + /** table */ + Table = "table", +} + +/** + * The name of the tuning option. \ + * {@link KnownTuningOptionParameterEnum} can be used interchangeably with TuningOptionParameterEnum, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **index** \ + * **table** + */ +export type TuningOptionParameterEnum = string; + +/** List of server tuning options. */ +export interface _TuningOptionsList { + /** The TuningOptions items on this page */ + value: TuningOptions[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _tuningOptionsListDeserializer(item: any): _TuningOptionsList { + return { + value: tuningOptionsArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function tuningOptionsArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return tuningOptionsDeserializer(item); + }); +} + +/** List of available object recommendations. */ +export interface _ObjectRecommendationList { + /** The ObjectRecommendation items on this page */ + value: ObjectRecommendation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _objectRecommendationListDeserializer(item: any): _ObjectRecommendationList { + return { + value: objectRecommendationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function objectRecommendationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return objectRecommendationDeserializer(item); + }); +} + +/** Object recommendation properties. */ +export interface ObjectRecommendation extends ProxyResource { + /** Always empty. */ + kind?: string; + /** Creation time (UTC) of this recommendation. */ + initialRecommendedTime?: Date; + /** Last time (UTC) that this recommendation was produced. */ + lastRecommendedTime?: Date; + /** Number of times this recommendation has been produced. */ + timesRecommended?: number; + /** List of identifiers for all queries identified as targets for improvement if the recommendation is applied. The list is only populated for CREATE INDEX recommendations. */ + improvedQueryIds?: number[]; + /** Reason for this recommendation. */ + recommendationReason?: string; + /** Current state. */ + currentState?: string; + /** Type for this recommendation. */ + recommendationType?: RecommendationTypeEnum; + /** Implementation details for the recommended action. */ + implementationDetails?: ObjectRecommendationPropertiesImplementationDetails; + /** Workload information for the recommended action. */ + analyzedWorkload?: ObjectRecommendationPropertiesAnalyzedWorkload; + /** Estimated impact of this recommended action. */ + readonly estimatedImpact?: ImpactRecord[]; + /** Recommendation details for the recommended action. */ + readonly details?: ObjectRecommendationDetails; +} + +export function objectRecommendationDeserializer(item: any): ObjectRecommendation { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + kind: item["kind"], + ...(!item["properties"] + ? item["properties"] + : _objectRecommendationPropertiesDeserializer(item["properties"])), + }; +} + +/** Object recommendation properties. */ +export interface ObjectRecommendationProperties { + /** Creation time (UTC) of this recommendation. */ + initialRecommendedTime?: Date; + /** Last time (UTC) that this recommendation was produced. */ + lastRecommendedTime?: Date; + /** Number of times this recommendation has been produced. */ + timesRecommended?: number; + /** List of identifiers for all queries identified as targets for improvement if the recommendation is applied. The list is only populated for CREATE INDEX recommendations. */ + improvedQueryIds?: number[]; + /** Reason for this recommendation. */ + recommendationReason?: string; + /** Current state. */ + currentState?: string; + /** Type for this recommendation. */ + recommendationType?: RecommendationTypeEnum; + /** Implementation details for the recommended action. */ + implementationDetails?: ObjectRecommendationPropertiesImplementationDetails; + /** Workload information for the recommended action. */ + analyzedWorkload?: ObjectRecommendationPropertiesAnalyzedWorkload; + /** Estimated impact of this recommended action. */ + readonly estimatedImpact?: ImpactRecord[]; + /** Recommendation details for the recommended action. */ + readonly details?: ObjectRecommendationDetails; +} + +export function objectRecommendationPropertiesDeserializer( + item: any, +): ObjectRecommendationProperties { + return { + initialRecommendedTime: !item["initialRecommendedTime"] + ? item["initialRecommendedTime"] + : new Date(item["initialRecommendedTime"]), + lastRecommendedTime: !item["lastRecommendedTime"] + ? item["lastRecommendedTime"] + : new Date(item["lastRecommendedTime"]), + timesRecommended: item["timesRecommended"], + improvedQueryIds: !item["improvedQueryIds"] + ? item["improvedQueryIds"] + : item["improvedQueryIds"].map((p: any) => { + return p; + }), + recommendationReason: item["recommendationReason"], + currentState: item["currentState"], + recommendationType: item["recommendationType"], + implementationDetails: !item["implementationDetails"] + ? item["implementationDetails"] + : objectRecommendationPropertiesImplementationDetailsDeserializer( + item["implementationDetails"], + ), + analyzedWorkload: !item["analyzedWorkload"] + ? item["analyzedWorkload"] + : objectRecommendationPropertiesAnalyzedWorkloadDeserializer(item["analyzedWorkload"]), + estimatedImpact: !item["estimatedImpact"] + ? item["estimatedImpact"] + : impactRecordArrayDeserializer(item["estimatedImpact"]), + details: !item["details"] + ? item["details"] + : objectRecommendationDetailsDeserializer(item["details"]), + }; +} + +/** Type for this recommendation. */ +export enum KnownRecommendationTypeEnum { + /** CreateIndex */ + CreateIndex = "CreateIndex", + /** DropIndex */ + DropIndex = "DropIndex", + /** ReIndex */ + ReIndex = "ReIndex", + /** AnalyzeTable */ + AnalyzeTable = "AnalyzeTable", + /** VacuumTable */ + VacuumTable = "VacuumTable", +} + +/** + * Type for this recommendation. \ + * {@link KnownRecommendationTypeEnum} can be used interchangeably with RecommendationTypeEnum, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **CreateIndex** \ + * **DropIndex** \ + * **ReIndex** \ + * **AnalyzeTable** \ + * **VacuumTable** + */ +export type RecommendationTypeEnum = string; + +/** Implementation details for the recommended action. */ +export interface ObjectRecommendationPropertiesImplementationDetails { + /** Method of implementation for recommended action. */ + method?: string; + /** Implementation script for the recommended action. */ + script?: string; +} + +export function objectRecommendationPropertiesImplementationDetailsDeserializer( + item: any, +): ObjectRecommendationPropertiesImplementationDetails { + return { + method: item["method"], + script: item["script"], + }; +} + +/** Workload information for the recommended action. */ +export interface ObjectRecommendationPropertiesAnalyzedWorkload { + /** Start time (UTC) of the workload analyzed. */ + startTime?: Date; + /** End time (UTC) of the workload analyzed. */ + endTime?: Date; + /** Number of queries from the workload that were examined to produce this recommendation. For DROP INDEX recommendations it's 0 (zero). */ + queryCount?: number; +} + +export function objectRecommendationPropertiesAnalyzedWorkloadDeserializer( + item: any, +): ObjectRecommendationPropertiesAnalyzedWorkload { + return { + startTime: !item["startTime"] ? item["startTime"] : new Date(item["startTime"]), + endTime: !item["endTime"] ? item["endTime"] : new Date(item["endTime"]), + queryCount: item["queryCount"], + }; +} + +export function impactRecordArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return impactRecordDeserializer(item); + }); +} + +/** Impact on some metric if this recommended action is applied. */ +export interface ImpactRecord { + /** Dimension name. */ + dimensionName?: string; + /** Dimension unit. */ + unit?: string; + /** Optional property that can be used to store the identifier of the query, if the metric is for a specific query. */ + queryId?: number; + /** Absolute value. */ + absoluteValue?: number; +} + +export function impactRecordDeserializer(item: any): ImpactRecord { + return { + dimensionName: item["dimensionName"], + unit: item["unit"], + queryId: item["queryId"], + absoluteValue: item["absoluteValue"], + }; +} + +/** Recommendation details for the recommended action. */ +export interface ObjectRecommendationDetails { + /** Database name. */ + databaseName?: string; + /** Schema name. */ + schema?: string; + /** Table name. */ + table?: string; + /** Index type. */ + indexType?: string; + /** Index name. */ + indexName?: string; + /** Index columns. */ + indexColumns?: string[]; + /** Index included columns. */ + includedColumns?: string[]; +} + +export function objectRecommendationDetailsDeserializer(item: any): ObjectRecommendationDetails { + return { + databaseName: item["databaseName"], + schema: item["schema"], + table: item["table"], + indexType: item["indexType"], + indexName: item["indexName"], + indexColumns: !item["indexColumns"] + ? item["indexColumns"] + : item["indexColumns"].map((p: any) => { + return p; + }), + includedColumns: !item["includedColumns"] + ? item["includedColumns"] + : item["includedColumns"].map((p: any) => { + return p; + }), + }; +} + +/** The check availability request body. */ +export interface CheckNameAvailabilityRequest { + /** The name of the resource for which availability needs to be checked. */ + name?: string; + /** The resource type. */ + type?: string; +} + +export function checkNameAvailabilityRequestSerializer(item: CheckNameAvailabilityRequest): any { + return { name: item["name"], type: item["type"] }; +} + +/** Availability of a name. */ +export interface NameAvailabilityModel extends CheckNameAvailabilityResponse { + /** Name for which validity and availability was checked. */ + readonly name?: string; + /** Type of resource. It can be 'Microsoft.DBforPostgreSQL/flexibleServers' or 'Microsoft.DBforPostgreSQL/flexibleServers/virtualendpoints'. */ + readonly type?: string; +} + +export function nameAvailabilityModelDeserializer(item: any): NameAvailabilityModel { + return { + nameAvailable: item["nameAvailable"], + reason: item["reason"], + message: item["message"], + name: item["name"], + type: item["type"], + }; +} + +/** The check availability result. */ +export interface CheckNameAvailabilityResponse { + /** Indicates if the resource name is available. */ + nameAvailable?: boolean; + /** The reason why the given name is not available. */ + reason?: CheckNameAvailabilityReason; + /** Detailed reason why the given name is not available. */ + message?: string; +} + +export function checkNameAvailabilityResponseDeserializer( + item: any, +): CheckNameAvailabilityResponse { + return { + nameAvailable: item["nameAvailable"], + reason: item["reason"], + message: item["message"], + }; +} + +/** Possible reasons for a name not being available. */ +export enum KnownCheckNameAvailabilityReason { + /** Name is invalid. */ + Invalid = "Invalid", + /** Name already exists. */ + AlreadyExists = "AlreadyExists", +} + +/** + * Possible reasons for a name not being available. \ + * {@link KnownCheckNameAvailabilityReason} can be used interchangeably with CheckNameAvailabilityReason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid**: Name is invalid. \ + * **AlreadyExists**: Name already exists. + */ +export type CheckNameAvailabilityReason = string; + +/** Capability for the PostgreSQL server */ +export interface _QuotaUsageList { + /** The QuotaUsage items on this page */ + readonly value: QuotaUsage[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _quotaUsageListDeserializer(item: any): _QuotaUsageList { + return { + value: quotaUsageArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function quotaUsageArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return quotaUsageDeserializer(item); + }); +} + +/** Quota usage for servers */ +export interface QuotaUsage { + /** Name of quota usage for servers */ + name?: NameProperty; + /** Quota limit */ + limit?: number; + /** Quota unit */ + unit?: string; + /** Current Quota usage value */ + currentValue?: number; + /** Fully qualified ARM resource Id */ + id?: string; +} + +export function quotaUsageDeserializer(item: any): QuotaUsage { + return { + name: !item["name"] ? item["name"] : namePropertyDeserializer(item["name"]), + limit: item["limit"], + unit: item["unit"], + currentValue: item["currentValue"], + id: item["id"], + }; +} + +/** Name property for quota usage */ +export interface NameProperty { + /** Name value */ + value?: string; + /** Localized name */ + localizedValue?: string; +} + +export function namePropertyDeserializer(item: any): NameProperty { + return { + value: item["value"], + localizedValue: item["localizedValue"], + }; +} + +/** Virtual network subnet usage parameter */ +export interface VirtualNetworkSubnetUsageParameter { + /** Virtual network resource id. */ + virtualNetworkArmResourceId?: string; +} + +export function virtualNetworkSubnetUsageParameterSerializer( + item: VirtualNetworkSubnetUsageParameter, +): any { + return { virtualNetworkArmResourceId: item["virtualNetworkArmResourceId"] }; +} + +/** Virtual network subnet usage data. */ +export interface VirtualNetworkSubnetUsageModel { + readonly delegatedSubnetsUsage?: DelegatedSubnetUsage[]; + /** location of the delegated subnet usage */ + readonly location?: string; + /** subscriptionId of the delegated subnet usage */ + readonly subscriptionId?: string; +} + +export function virtualNetworkSubnetUsageModelDeserializer( + item: any, +): VirtualNetworkSubnetUsageModel { + return { + delegatedSubnetsUsage: !item["delegatedSubnetsUsage"] + ? item["delegatedSubnetsUsage"] + : delegatedSubnetUsageArrayDeserializer(item["delegatedSubnetsUsage"]), + location: item["location"], + subscriptionId: item["subscriptionId"], + }; +} + +export function delegatedSubnetUsageArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return delegatedSubnetUsageDeserializer(item); + }); +} + +/** Delegated subnet usage data. */ +export interface DelegatedSubnetUsage { + /** Name of the delegated subnet for which IP addresses are in use */ + readonly subnetName?: string; + /** Number of IP addresses used by the delegated subnet */ + readonly usage?: number; +} + +export function delegatedSubnetUsageDeserializer(item: any): DelegatedSubnetUsage { + return { + subnetName: item["subnetName"], + usage: item["usage"], + }; +} + +/** Known values of {@link MigrationListFilter} that the service accepts. */ +export enum KnownMigrationListFilter { + /** Active */ + Active = "Active", + /** All */ + All = "All", +} + +/** Type of MigrationListFilter */ +export type MigrationListFilter = string; + +/** Recommendations list filter. Retrieves recommendations based on type. */ +export enum KnownRecommendationTypeParameterEnum { + /** CreateIndex */ + CreateIndex = "CreateIndex", + /** DropIndex */ + DropIndex = "DropIndex", + /** ReIndex */ + ReIndex = "ReIndex", + /** AnalyzeTable */ + AnalyzeTable = "AnalyzeTable", + /** VacuumTable */ + VacuumTable = "VacuumTable", +} + +/** + * Recommendations list filter. Retrieves recommendations based on type. \ + * {@link KnownRecommendationTypeParameterEnum} can be used interchangeably with RecommendationTypeParameterEnum, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **CreateIndex** \ + * **DropIndex** \ + * **ReIndex** \ + * **AnalyzeTable** \ + * **VacuumTable** + */ +export type RecommendationTypeParameterEnum = string; + +/** The available API versions. */ +export enum KnownVersions { + /** The 2025-08-01 API version. */ + V20250801 = "2025-08-01", + /** The 2026-01-01-preview API version. */ + V20260101 = "2026-01-01-preview", +} + +export function _migrationPropertiesSerializer(item: Migration): any { + return { + migrationInstanceResourceId: item["migrationInstanceResourceId"], + migrationMode: item["migrationMode"], + migrationOption: item["migrationOption"], + sourceType: item["sourceType"], + sslMode: item["sslMode"], + sourceDbServerResourceId: item["sourceDbServerResourceId"], + sourceDbServerFullyQualifiedDomainName: item["sourceDbServerFullyQualifiedDomainName"], + targetDbServerFullyQualifiedDomainName: item["targetDbServerFullyQualifiedDomainName"], + secretParameters: !item["secretParameters"] + ? item["secretParameters"] + : migrationSecretParametersSerializer(item["secretParameters"]), + dbsToMigrate: !item["dbsToMigrate"] + ? item["dbsToMigrate"] + : item["dbsToMigrate"].map((p: any) => { + return p; + }), + setupLogicalReplicationOnSourceDbIfNeeded: item["setupLogicalReplicationOnSourceDbIfNeeded"], + overwriteDbsInTarget: item["overwriteDbsInTarget"], + migrationWindowStartTimeInUtc: !item["migrationWindowStartTimeInUtc"] + ? item["migrationWindowStartTimeInUtc"] + : item["migrationWindowStartTimeInUtc"].toISOString(), + migrationWindowEndTimeInUtc: !item["migrationWindowEndTimeInUtc"] + ? item["migrationWindowEndTimeInUtc"] + : item["migrationWindowEndTimeInUtc"].toISOString(), + migrateRoles: item["migrateRoles"], + startDataMigration: item["startDataMigration"], + triggerCutover: item["triggerCutover"], + dbsToTriggerCutoverOn: !item["dbsToTriggerCutoverOn"] + ? item["dbsToTriggerCutoverOn"] + : item["dbsToTriggerCutoverOn"].map((p: any) => { + return p; + }), + cancel: item["cancel"], + dbsToCancelMigrationOn: !item["dbsToCancelMigrationOn"] + ? item["dbsToCancelMigrationOn"] + : item["dbsToCancelMigrationOn"].map((p: any) => { + return p; + }), + }; +} + +export function _migrationPropertiesDeserializer(item: any) { + return { + migrationId: item["migrationId"], + currentStatus: !item["currentStatus"] + ? item["currentStatus"] + : migrationStatusDeserializer(item["currentStatus"]), + migrationInstanceResourceId: item["migrationInstanceResourceId"], + migrationMode: item["migrationMode"], + migrationOption: item["migrationOption"], + sourceType: item["sourceType"], + sslMode: item["sslMode"], + sourceDbServerMetadata: !item["sourceDbServerMetadata"] + ? item["sourceDbServerMetadata"] + : dbServerMetadataDeserializer(item["sourceDbServerMetadata"]), + targetDbServerMetadata: !item["targetDbServerMetadata"] + ? item["targetDbServerMetadata"] + : dbServerMetadataDeserializer(item["targetDbServerMetadata"]), + sourceDbServerResourceId: item["sourceDbServerResourceId"], + sourceDbServerFullyQualifiedDomainName: item["sourceDbServerFullyQualifiedDomainName"], + targetDbServerResourceId: item["targetDbServerResourceId"], + targetDbServerFullyQualifiedDomainName: item["targetDbServerFullyQualifiedDomainName"], + secretParameters: !item["secretParameters"] + ? item["secretParameters"] + : migrationSecretParametersDeserializer(item["secretParameters"]), + dbsToMigrate: !item["dbsToMigrate"] + ? item["dbsToMigrate"] + : item["dbsToMigrate"].map((p: any) => { + return p; + }), + setupLogicalReplicationOnSourceDbIfNeeded: item["setupLogicalReplicationOnSourceDbIfNeeded"], + overwriteDbsInTarget: item["overwriteDbsInTarget"], + migrationWindowStartTimeInUtc: !item["migrationWindowStartTimeInUtc"] + ? item["migrationWindowStartTimeInUtc"] + : new Date(item["migrationWindowStartTimeInUtc"]), + migrationWindowEndTimeInUtc: !item["migrationWindowEndTimeInUtc"] + ? item["migrationWindowEndTimeInUtc"] + : new Date(item["migrationWindowEndTimeInUtc"]), + migrateRoles: item["migrateRoles"], + startDataMigration: item["startDataMigration"], + triggerCutover: item["triggerCutover"], + dbsToTriggerCutoverOn: !item["dbsToTriggerCutoverOn"] + ? item["dbsToTriggerCutoverOn"] + : item["dbsToTriggerCutoverOn"].map((p: any) => { + return p; + }), + cancel: item["cancel"], + dbsToCancelMigrationOn: !item["dbsToCancelMigrationOn"] + ? item["dbsToCancelMigrationOn"] + : item["dbsToCancelMigrationOn"].map((p: any) => { + return p; + }), + }; +} + +export function _migrationResourceForPatchPropertiesSerializer( + item: MigrationResourceForPatch, +): any { + return { + sourceDbServerResourceId: item["sourceDbServerResourceId"], + sourceDbServerFullyQualifiedDomainName: item["sourceDbServerFullyQualifiedDomainName"], + targetDbServerFullyQualifiedDomainName: item["targetDbServerFullyQualifiedDomainName"], + secretParameters: !item["secretParameters"] + ? item["secretParameters"] + : migrationSecretParametersForPatchSerializer(item["secretParameters"]), + dbsToMigrate: !item["dbsToMigrate"] + ? item["dbsToMigrate"] + : item["dbsToMigrate"].map((p: any) => { + return p; + }), + setupLogicalReplicationOnSourceDbIfNeeded: item["setupLogicalReplicationOnSourceDbIfNeeded"], + overwriteDbsInTarget: item["overwriteDbsInTarget"], + migrationWindowStartTimeInUtc: !item["migrationWindowStartTimeInUtc"] + ? item["migrationWindowStartTimeInUtc"] + : item["migrationWindowStartTimeInUtc"].toISOString(), + migrateRoles: item["migrateRoles"], + startDataMigration: item["startDataMigration"], + triggerCutover: item["triggerCutover"], + dbsToTriggerCutoverOn: !item["dbsToTriggerCutoverOn"] + ? item["dbsToTriggerCutoverOn"] + : item["dbsToTriggerCutoverOn"].map((p: any) => { + return p; + }), + cancel: item["cancel"], + dbsToCancelMigrationOn: !item["dbsToCancelMigrationOn"] + ? item["dbsToCancelMigrationOn"] + : item["dbsToCancelMigrationOn"].map((p: any) => { + return p; + }), + migrationMode: item["migrationMode"], + }; +} + +export function _privateEndpointConnectionPropertiesSerializer( + item: PrivateEndpointConnection, +): any { + return { + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointSerializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: !item["privateLinkServiceConnectionState"] + ? item["privateLinkServiceConnectionState"] + : privateLinkServiceConnectionStateSerializer(item["privateLinkServiceConnectionState"]), + }; +} + +export function _privateEndpointConnectionPropertiesDeserializer(item: any) { + return { + groupIds: !item["groupIds"] + ? item["groupIds"] + : item["groupIds"].map((p: any) => { + return p; + }), + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointDeserializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: !item["privateLinkServiceConnectionState"] + ? item["privateLinkServiceConnectionState"] + : privateLinkServiceConnectionStateDeserializer(item["privateLinkServiceConnectionState"]), + provisioningState: item["provisioningState"], + }; +} + +export function _serverPropertiesSerializer(item: Server): any { + return { + administratorLogin: item["administratorLogin"], + administratorLoginPassword: item["administratorLoginPassword"], + version: item["version"], + storage: !item["storage"] ? item["storage"] : storageSerializer(item["storage"]), + authConfig: !item["authConfig"] ? item["authConfig"] : authConfigSerializer(item["authConfig"]), + dataEncryption: !item["dataEncryption"] + ? item["dataEncryption"] + : dataEncryptionSerializer(item["dataEncryption"]), + backup: !item["backup"] ? item["backup"] : backupSerializer(item["backup"]), + network: !item["network"] ? item["network"] : networkSerializer(item["network"]), + highAvailability: !item["highAvailability"] + ? item["highAvailability"] + : highAvailabilitySerializer(item["highAvailability"]), + maintenanceWindow: !item["maintenanceWindow"] + ? item["maintenanceWindow"] + : maintenanceWindowSerializer(item["maintenanceWindow"]), + sourceServerResourceId: item["sourceServerResourceId"], + pointInTimeUTC: !item["pointInTimeUTC"] + ? item["pointInTimeUTC"] + : item["pointInTimeUTC"].toISOString(), + availabilityZone: item["availabilityZone"], + replicationRole: item["replicationRole"], + replica: !item["replica"] ? item["replica"] : replicaSerializer(item["replica"]), + createMode: item["createMode"], + cluster: !item["cluster"] ? item["cluster"] : clusterSerializer(item["cluster"]), + }; +} + +export function _serverPropertiesDeserializer(item: any) { + return { + administratorLogin: item["administratorLogin"], + administratorLoginPassword: item["administratorLoginPassword"], + version: item["version"], + minorVersion: item["minorVersion"], + state: item["state"], + fullyQualifiedDomainName: item["fullyQualifiedDomainName"], + storage: !item["storage"] ? item["storage"] : storageDeserializer(item["storage"]), + authConfig: !item["authConfig"] + ? item["authConfig"] + : authConfigDeserializer(item["authConfig"]), + dataEncryption: !item["dataEncryption"] + ? item["dataEncryption"] + : dataEncryptionDeserializer(item["dataEncryption"]), + backup: !item["backup"] ? item["backup"] : backupDeserializer(item["backup"]), + network: !item["network"] ? item["network"] : networkDeserializer(item["network"]), + highAvailability: !item["highAvailability"] + ? item["highAvailability"] + : highAvailabilityDeserializer(item["highAvailability"]), + maintenanceWindow: !item["maintenanceWindow"] + ? item["maintenanceWindow"] + : maintenanceWindowDeserializer(item["maintenanceWindow"]), + sourceServerResourceId: item["sourceServerResourceId"], + pointInTimeUTC: !item["pointInTimeUTC"] + ? item["pointInTimeUTC"] + : new Date(item["pointInTimeUTC"]), + availabilityZone: item["availabilityZone"], + replicationRole: item["replicationRole"], + replicaCapacity: item["replicaCapacity"], + replica: !item["replica"] ? item["replica"] : replicaDeserializer(item["replica"]), + createMode: item["createMode"], + privateEndpointConnections: !item["privateEndpointConnections"] + ? item["privateEndpointConnections"] + : privateEndpointConnectionArrayDeserializer(item["privateEndpointConnections"]), + cluster: !item["cluster"] ? item["cluster"] : clusterDeserializer(item["cluster"]), + }; +} + +export function _serverForPatchPropertiesSerializer(item: ServerForPatch): any { + return { + administratorLoginPassword: item["administratorLoginPassword"], + version: item["version"], + storage: !item["storage"] ? item["storage"] : storageSerializer(item["storage"]), + backup: !item["backup"] ? item["backup"] : backupForPatchSerializer(item["backup"]), + highAvailability: !item["highAvailability"] + ? item["highAvailability"] + : highAvailabilityForPatchSerializer(item["highAvailability"]), + maintenanceWindow: !item["maintenanceWindow"] + ? item["maintenanceWindow"] + : maintenanceWindowForPatchSerializer(item["maintenanceWindow"]), + authConfig: !item["authConfig"] + ? item["authConfig"] + : authConfigForPatchSerializer(item["authConfig"]), + dataEncryption: !item["dataEncryption"] + ? item["dataEncryption"] + : dataEncryptionSerializer(item["dataEncryption"]), + availabilityZone: item["availabilityZone"], + createMode: item["createMode"], + replicationRole: item["replicationRole"], + replica: !item["replica"] ? item["replica"] : replicaSerializer(item["replica"]), + network: !item["network"] ? item["network"] : networkSerializer(item["network"]), + cluster: !item["cluster"] ? item["cluster"] : clusterSerializer(item["cluster"]), + }; +} + +export function _configurationPropertiesSerializer(item: Configuration): any { + return { value: item["value"], source: item["source"] }; +} + +export function _configurationPropertiesDeserializer(item: any) { + return { + value: item["value"], + description: item["description"], + defaultValue: item["defaultValue"], + dataType: item["dataType"], + allowedValues: item["allowedValues"], + source: item["source"], + isDynamicConfig: item["isDynamicConfig"], + isReadOnly: item["isReadOnly"], + isConfigPendingRestart: item["isConfigPendingRestart"], + unit: item["unit"], + documentationLink: item["documentationLink"], + }; +} + +export function _configurationForUpdatePropertiesSerializer(item: ConfigurationForUpdate): any { + return { value: item["value"], source: item["source"] }; +} + +export function _configurationForUpdatePropertiesDeserializer(item: any) { + return { + value: item["value"], + description: item["description"], + defaultValue: item["defaultValue"], + dataType: item["dataType"], + allowedValues: item["allowedValues"], + source: item["source"], + isDynamicConfig: item["isDynamicConfig"], + isReadOnly: item["isReadOnly"], + isConfigPendingRestart: item["isConfigPendingRestart"], + unit: item["unit"], + documentationLink: item["documentationLink"], + }; +} + +export function _databasePropertiesSerializer(item: Database): any { + return { charset: item["charset"], collation: item["collation"] }; +} + +export function _databasePropertiesDeserializer(item: any) { + return { + charset: item["charset"], + collation: item["collation"], + }; +} + +export function _firewallRulePropertiesSerializer(item: FirewallRule): any { + return { startIpAddress: item["startIpAddress"], endIpAddress: item["endIpAddress"] }; +} + +export function _firewallRulePropertiesDeserializer(item: any) { + return { + startIpAddress: item["startIpAddress"], + endIpAddress: item["endIpAddress"], + }; +} + +export function _privateLinkResourcePropertiesDeserializer(item: any) { + 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; + }), + }; +} + +export function _virtualEndpointPropertiesSerializer(item: VirtualEndpoint): any { + return { + endpointType: item["endpointType"], + members: !item["members"] + ? item["members"] + : item["members"].map((p: any) => { + return p; + }), + }; +} + +export function _virtualEndpointPropertiesDeserializer(item: any) { + return { + endpointType: item["endpointType"], + members: !item["members"] + ? item["members"] + : item["members"].map((p: any) => { + return p; + }), + virtualEndpoints: !item["virtualEndpoints"] + ? item["virtualEndpoints"] + : item["virtualEndpoints"].map((p: any) => { + return p; + }), + }; +} + +export function _virtualEndpointResourceForPatchPropertiesSerializer( + item: VirtualEndpointResourceForPatch, +): any { + return { + endpointType: item["endpointType"], + members: !item["members"] + ? item["members"] + : item["members"].map((p: any) => { + return p; + }), + }; +} + +export function _virtualEndpointResourceForPatchPropertiesDeserializer(item: any) { + return { + endpointType: item["endpointType"], + members: !item["members"] + ? item["members"] + : item["members"].map((p: any) => { + return p; + }), + virtualEndpoints: !item["virtualEndpoints"] + ? item["virtualEndpoints"] + : item["virtualEndpoints"].map((p: any) => { + return p; + }), + }; +} + +export function _administratorMicrosoftEntraPropertiesDeserializer(item: any) { + return { + principalType: item["principalType"], + principalName: item["principalName"], + objectId: item["objectId"], + tenantId: item["tenantId"], + }; +} + +export function _administratorMicrosoftEntraAddPropertiesSerializer( + item: AdministratorMicrosoftEntraAdd, +): any { + return { + principalType: item["principalType"], + principalName: item["principalName"], + tenantId: item["tenantId"], + }; +} + +export function _capturedLogPropertiesDeserializer(item: any) { + return { + createdTime: !item["createdTime"] ? item["createdTime"] : new Date(item["createdTime"]), + lastModifiedTime: !item["lastModifiedTime"] + ? item["lastModifiedTime"] + : new Date(item["lastModifiedTime"]), + sizeInKb: item["sizeInKb"], + typePropertiesType: item["type"], + url: item["url"], + }; +} + +export function _ltrPreBackupResponsePropertiesDeserializer(item: any) { + return { + numberOfContainers: item["numberOfContainers"], + }; +} + +export function _backupsLongTermRetentionResponsePropertiesDeserializer(item: any) { + return { + datasourceSizeInBytes: item["datasourceSizeInBytes"], + dataTransferredInBytes: item["dataTransferredInBytes"], + backupName: item["backupName"], + backupMetadata: item["backupMetadata"], + status: item["status"], + startTime: !item["startTime"] ? item["startTime"] : new Date(item["startTime"]), + endTime: !item["endTime"] ? item["endTime"] : new Date(item["endTime"]), + percentComplete: item["percentComplete"], + errorCode: item["errorCode"], + errorMessage: item["errorMessage"], + }; +} + +export function _backupsLongTermRetentionOperationPropertiesDeserializer(item: any) { + return { + datasourceSizeInBytes: item["datasourceSizeInBytes"], + dataTransferredInBytes: item["dataTransferredInBytes"], + backupName: item["backupName"], + backupMetadata: item["backupMetadata"], + status: item["status"], + startTime: !item["startTime"] ? item["startTime"] : new Date(item["startTime"]), + endTime: !item["endTime"] ? item["endTime"] : new Date(item["endTime"]), + percentComplete: item["percentComplete"], + errorCode: item["errorCode"], + errorMessage: item["errorMessage"], + }; +} + +export function _advancedThreatProtectionSettingsModelPropertiesSerializer( + item: AdvancedThreatProtectionSettingsModel, +): any { + return { state: item["state"] }; +} + +export function _advancedThreatProtectionSettingsModelPropertiesDeserializer(item: any) { + return { + state: item["state"], + creationTime: !item["creationTime"] ? item["creationTime"] : new Date(item["creationTime"]), + }; +} + +export function _backupAutomaticAndOnDemandPropertiesDeserializer(item: any) { + return { + backupType: item["backupType"], + completedTime: !item["completedTime"] ? item["completedTime"] : new Date(item["completedTime"]), + source: item["source"], + }; +} + +export function _objectRecommendationPropertiesDeserializer(item: any) { + return { + initialRecommendedTime: !item["initialRecommendedTime"] + ? item["initialRecommendedTime"] + : new Date(item["initialRecommendedTime"]), + lastRecommendedTime: !item["lastRecommendedTime"] + ? item["lastRecommendedTime"] + : new Date(item["lastRecommendedTime"]), + timesRecommended: item["timesRecommended"], + improvedQueryIds: !item["improvedQueryIds"] + ? item["improvedQueryIds"] + : item["improvedQueryIds"].map((p: any) => { + return p; + }), + recommendationReason: item["recommendationReason"], + currentState: item["currentState"], + recommendationType: item["recommendationType"], + implementationDetails: !item["implementationDetails"] + ? item["implementationDetails"] + : objectRecommendationPropertiesImplementationDetailsDeserializer( + item["implementationDetails"], + ), + analyzedWorkload: !item["analyzedWorkload"] + ? item["analyzedWorkload"] + : objectRecommendationPropertiesAnalyzedWorkloadDeserializer(item["analyzedWorkload"]), + estimatedImpact: !item["estimatedImpact"] + ? item["estimatedImpact"] + : impactRecordArrayDeserializer(item["estimatedImpact"]), + details: !item["details"] + ? item["details"] + : objectRecommendationDetailsDeserializer(item["details"]), + }; +} + +export type PrivateDnsZoneSuffixGetResponse = { body: string }; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/models/parameters.ts b/sdk/postgresql/arm-postgresql-flexible/src/models/parameters.ts deleted file mode 100644 index 6a5b3e59957b..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/models/parameters.ts +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { - OperationParameter, - OperationURLParameter, - OperationQueryParameter, -} from "@azure/core-client"; -import { - AdministratorMicrosoftEntraAdd as AdministratorMicrosoftEntraAddMapper, - AdvancedThreatProtectionSettingsModel as AdvancedThreatProtectionSettingsModelMapper, - ConfigurationForUpdate as ConfigurationForUpdateMapper, - Database as DatabaseMapper, - FirewallRule as FirewallRuleMapper, - LtrPreBackupRequest as LtrPreBackupRequestMapper, - BackupsLongTermRetentionRequest as BackupsLongTermRetentionRequestMapper, - Migration as MigrationMapper, - MigrationResourceForPatch as MigrationResourceForPatchMapper, - MigrationNameAvailability as MigrationNameAvailabilityMapper, - CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper, - PrivateEndpointConnection as PrivateEndpointConnectionMapper, - Server as ServerMapper, - ServerForPatch as ServerForPatchMapper, - RestartParameter as RestartParameterMapper, - VirtualEndpoint as VirtualEndpointMapper, - VirtualEndpointResourceForPatch as VirtualEndpointResourceForPatchMapper, - VirtualNetworkSubnetUsageParameter as VirtualNetworkSubnetUsageParameterMapper, -} from "../models/mappers.js"; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String", - }, - }, -}; - -export const parameters: OperationParameter = { - parameterPath: "parameters", - mapper: AdministratorMicrosoftEntraAddMapper, -}; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String", - }, - }, -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const subscriptionId: OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - serializedName: "subscriptionId", - required: true, - type: { - name: "Uuid", - }, - }, -}; - -export const resourceGroupName: OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - constraints: { - MaxLength: 90, - MinLength: 1, - }, - serializedName: "resourceGroupName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const serverName: OperationURLParameter = { - parameterPath: "serverName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*"), - MaxLength: 63, - MinLength: 3, - }, - serializedName: "serverName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const objectId: OperationURLParameter = { - parameterPath: "objectId", - mapper: { - serializedName: "objectId", - required: true, - type: { - name: "String", - }, - }, -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2025-08-01", - isConstant: true, - serializedName: "api-version", - type: { - name: "String", - }, - }, -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const threatProtectionName: OperationURLParameter = { - parameterPath: "threatProtectionName", - mapper: { - serializedName: "threatProtectionName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const parameters1: OperationParameter = { - parameterPath: "parameters", - mapper: AdvancedThreatProtectionSettingsModelMapper, -}; - -export const backupName: OperationURLParameter = { - parameterPath: "backupName", - mapper: { - constraints: { - Pattern: new RegExp("^[-\\w\\._]+$"), - MaxLength: 128, - MinLength: 1, - }, - serializedName: "backupName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const locationName: OperationURLParameter = { - parameterPath: "locationName", - mapper: { - constraints: { - Pattern: new RegExp("^[-\\w\\._]+$"), - MinLength: 1, - }, - serializedName: "locationName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const configurationName: OperationURLParameter = { - parameterPath: "configurationName", - mapper: { - constraints: { - Pattern: new RegExp("^[-\\w\\._]+$"), - MaxLength: 256, - MinLength: 1, - }, - serializedName: "configurationName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const parameters2: OperationParameter = { - parameterPath: "parameters", - mapper: ConfigurationForUpdateMapper, -}; - -export const parameters3: OperationParameter = { - parameterPath: "parameters", - mapper: DatabaseMapper, -}; - -export const databaseName: OperationURLParameter = { - parameterPath: "databaseName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z_][\\w\\-]{0,62}$"), - MaxLength: 63, - MinLength: 1, - }, - serializedName: "databaseName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const parameters4: OperationParameter = { - parameterPath: "parameters", - mapper: FirewallRuleMapper, -}; - -export const firewallRuleName: OperationURLParameter = { - parameterPath: "firewallRuleName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9][-_a-zA-Z0-9]{0,79}(? -/** Class containing AdministratorsMicrosoftEntra operations. */ -export class AdministratorsMicrosoftEntraImpl implements AdministratorsMicrosoftEntra { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class AdministratorsMicrosoftEntra class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * List all server administrators associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: AdministratorsMicrosoftEntraListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: AdministratorsMicrosoftEntraListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: AdministratorsMicrosoftEntraListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: AdministratorsMicrosoftEntraListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Creates a new server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param parameters Required parameters for adding a server administrator associated to a Microsoft - * Entra principal. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - serverName: string, - objectId: string, - parameters: AdministratorMicrosoftEntraAdd, - options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AdministratorsMicrosoftEntraCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, objectId, parameters, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - AdministratorsMicrosoftEntraCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Creates a new server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param parameters Required parameters for adding a server administrator associated to a Microsoft - * Entra principal. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - serverName: string, - objectId: string, - parameters: AdministratorMicrosoftEntraAdd, - options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - serverName, - objectId, - parameters, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Deletes an existing server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - serverName: string, - objectId: string, - options?: AdministratorsMicrosoftEntraDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AdministratorsMicrosoftEntraDeleteResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, objectId, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - AdministratorsMicrosoftEntraDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Deletes an existing server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - objectId: string, - options?: AdministratorsMicrosoftEntraDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete(resourceGroupName, serverName, objectId, options); - return poller.pollUntilDone(); - } - - /** - * Gets information about a server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - objectId: string, - options?: AdministratorsMicrosoftEntraGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, objectId, options }, - getOperationSpec, - ); - } - - /** - * List all server administrators associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: AdministratorsMicrosoftEntraListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: AdministratorsMicrosoftEntraListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.AdministratorMicrosoftEntra, - }, - 201: { - bodyMapper: Mappers.AdministratorMicrosoftEntra, - }, - 202: { - bodyMapper: Mappers.AdministratorMicrosoftEntra, - }, - 204: { - bodyMapper: Mappers.AdministratorMicrosoftEntra, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.objectId, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.AdministratorsMicrosoftEntraDeleteHeaders, - }, - 201: { - headersMapper: Mappers.AdministratorsMicrosoftEntraDeleteHeaders, - }, - 202: { - headersMapper: Mappers.AdministratorsMicrosoftEntraDeleteHeaders, - }, - 204: { - headersMapper: Mappers.AdministratorsMicrosoftEntraDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.objectId, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AdministratorMicrosoftEntra, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.objectId, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AdministratorMicrosoftEntraList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AdministratorMicrosoftEntraList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/advancedThreatProtectionSettings.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/advancedThreatProtectionSettings.ts deleted file mode 100644 index a5e62dbf44d2..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/advancedThreatProtectionSettings.ts +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { AdvancedThreatProtectionSettings } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - AdvancedThreatProtectionSettingsModel, - AdvancedThreatProtectionSettingsListByServerNextOptionalParams, - AdvancedThreatProtectionSettingsListByServerOptionalParams, - AdvancedThreatProtectionSettingsListByServerResponse, - ThreatProtectionName, - AdvancedThreatProtectionSettingsGetOptionalParams, - AdvancedThreatProtectionSettingsGetResponse, - AdvancedThreatProtectionSettingsListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing AdvancedThreatProtectionSettings operations. */ -export class AdvancedThreatProtectionSettingsImpl implements AdvancedThreatProtectionSettings { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class AdvancedThreatProtectionSettings class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists state of advanced threat protection settings for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: AdvancedThreatProtectionSettingsListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: AdvancedThreatProtectionSettingsListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: AdvancedThreatProtectionSettingsListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: AdvancedThreatProtectionSettingsListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Lists state of advanced threat protection settings for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: AdvancedThreatProtectionSettingsListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * Gets state of advanced threat protection settings for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param threatProtectionName Name of the advanced threat protection settings. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - threatProtectionName: ThreatProtectionName, - options?: AdvancedThreatProtectionSettingsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, threatProtectionName, options }, - getOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: AdvancedThreatProtectionSettingsListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AdvancedThreatProtectionSettingsList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AdvancedThreatProtectionSettingsModel, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.threatProtectionName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AdvancedThreatProtectionSettingsList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/backupsAutomaticAndOnDemand.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/backupsAutomaticAndOnDemand.ts deleted file mode 100644 index ea6c98aba5cf..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/backupsAutomaticAndOnDemand.ts +++ /dev/null @@ -1,472 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { BackupsAutomaticAndOnDemand } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - BackupAutomaticAndOnDemand, - BackupsAutomaticAndOnDemandListByServerNextOptionalParams, - BackupsAutomaticAndOnDemandListByServerOptionalParams, - BackupsAutomaticAndOnDemandListByServerResponse, - BackupsAutomaticAndOnDemandCreateOptionalParams, - BackupsAutomaticAndOnDemandCreateResponse, - BackupsAutomaticAndOnDemandDeleteOptionalParams, - BackupsAutomaticAndOnDemandDeleteResponse, - BackupsAutomaticAndOnDemandGetOptionalParams, - BackupsAutomaticAndOnDemandGetResponse, - BackupsAutomaticAndOnDemandListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing BackupsAutomaticAndOnDemand operations. */ -export class BackupsAutomaticAndOnDemandImpl implements BackupsAutomaticAndOnDemand { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class BackupsAutomaticAndOnDemand class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists all available backups of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: BackupsAutomaticAndOnDemandListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: BackupsAutomaticAndOnDemandListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: BackupsAutomaticAndOnDemandListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: BackupsAutomaticAndOnDemandListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Creates an on demand backup of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - async beginCreate( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandCreateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - BackupsAutomaticAndOnDemandCreateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, backupName, options }, - spec: createOperationSpec, - }); - const poller = await createHttpPoller< - BackupsAutomaticAndOnDemandCreateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Creates an on demand backup of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - async beginCreateAndWait( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandCreateOptionalParams, - ): Promise { - const poller = await this.beginCreate(resourceGroupName, serverName, backupName, options); - return poller.pollUntilDone(); - } - - /** - * Deletes a specific backup, given its name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - BackupsAutomaticAndOnDemandDeleteResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, backupName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - BackupsAutomaticAndOnDemandDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Deletes a specific backup, given its name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete(resourceGroupName, serverName, backupName, options); - return poller.pollUntilDone(); - } - - /** - * Gets information of an on demand backup, given its name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, backupName, options }, - getOperationSpec, - ); - } - - /** - * Lists all available backups of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: BackupsAutomaticAndOnDemandListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: BackupsAutomaticAndOnDemandListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.BackupAutomaticAndOnDemand, - }, - 201: { - bodyMapper: Mappers.BackupAutomaticAndOnDemand, - }, - 202: { - bodyMapper: Mappers.BackupAutomaticAndOnDemand, - }, - 204: { - bodyMapper: Mappers.BackupAutomaticAndOnDemand, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.backupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.BackupsAutomaticAndOnDemandDeleteHeaders, - }, - 201: { - headersMapper: Mappers.BackupsAutomaticAndOnDemandDeleteHeaders, - }, - 202: { - headersMapper: Mappers.BackupsAutomaticAndOnDemandDeleteHeaders, - }, - 204: { - headersMapper: Mappers.BackupsAutomaticAndOnDemandDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.backupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BackupAutomaticAndOnDemand, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.backupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BackupAutomaticAndOnDemandList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BackupAutomaticAndOnDemandList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/backupsLongTermRetention.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/backupsLongTermRetention.ts deleted file mode 100644 index 158159b3272c..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/backupsLongTermRetention.ts +++ /dev/null @@ -1,404 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { BackupsLongTermRetention } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - BackupsLongTermRetentionOperation, - BackupsLongTermRetentionListByServerNextOptionalParams, - BackupsLongTermRetentionListByServerOptionalParams, - BackupsLongTermRetentionListByServerResponse, - LtrPreBackupRequest, - BackupsLongTermRetentionCheckPrerequisitesOptionalParams, - BackupsLongTermRetentionCheckPrerequisitesResponse, - BackupsLongTermRetentionRequest, - BackupsLongTermRetentionStartOptionalParams, - BackupsLongTermRetentionStartResponse, - BackupsLongTermRetentionGetOptionalParams, - BackupsLongTermRetentionGetResponse, - BackupsLongTermRetentionListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing BackupsLongTermRetention operations. */ -export class BackupsLongTermRetentionImpl implements BackupsLongTermRetention { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class BackupsLongTermRetention class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists the results of the long term retention backup operations for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: BackupsLongTermRetentionListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: BackupsLongTermRetentionListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: BackupsLongTermRetentionListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: BackupsLongTermRetentionListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Performs all checks required for a long term retention backup operation to succeed. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Request body for operation - * @param options The options parameters. - */ - checkPrerequisites( - resourceGroupName: string, - serverName: string, - parameters: LtrPreBackupRequest, - options?: BackupsLongTermRetentionCheckPrerequisitesOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, parameters, options }, - checkPrerequisitesOperationSpec, - ); - } - - /** - * Initiates a long term retention backup. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Request body for operation - * @param options The options parameters. - */ - async beginStart( - resourceGroupName: string, - serverName: string, - parameters: BackupsLongTermRetentionRequest, - options?: BackupsLongTermRetentionStartOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - BackupsLongTermRetentionStartResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, parameters, options }, - spec: startOperationSpec, - }); - const poller = await createHttpPoller< - BackupsLongTermRetentionStartResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Initiates a long term retention backup. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Request body for operation - * @param options The options parameters. - */ - async beginStartAndWait( - resourceGroupName: string, - serverName: string, - parameters: BackupsLongTermRetentionRequest, - options?: BackupsLongTermRetentionStartOptionalParams, - ): Promise { - const poller = await this.beginStart(resourceGroupName, serverName, parameters, options); - return poller.pollUntilDone(); - } - - /** - * Gets the results of a long retention backup operation for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName The name of the backup. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsLongTermRetentionGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, backupName, options }, - getOperationSpec, - ); - } - - /** - * Lists the results of the long term retention backup operations for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: BackupsLongTermRetentionListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: BackupsLongTermRetentionListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const checkPrerequisitesOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrPreBackup", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.LtrPreBackupResponse, - headersMapper: Mappers.BackupsLongTermRetentionCheckPrerequisitesHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - headersMapper: Mappers.BackupsLongTermRetentionCheckPrerequisitesExceptionHeaders, - }, - }, - requestBody: Parameters.parameters5, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const startOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/startLtrBackup", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.BackupsLongTermRetentionResponse, - headersMapper: Mappers.BackupsLongTermRetentionStartHeaders, - }, - 201: { - bodyMapper: Mappers.BackupsLongTermRetentionResponse, - headersMapper: Mappers.BackupsLongTermRetentionStartHeaders, - }, - 202: { - bodyMapper: Mappers.BackupsLongTermRetentionResponse, - headersMapper: Mappers.BackupsLongTermRetentionStartHeaders, - }, - 204: { - bodyMapper: Mappers.BackupsLongTermRetentionResponse, - headersMapper: Mappers.BackupsLongTermRetentionStartHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - headersMapper: Mappers.BackupsLongTermRetentionStartExceptionHeaders, - }, - }, - requestBody: Parameters.parameters6, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations/{backupName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BackupsLongTermRetentionOperation, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.backupName1, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LtrServerBackupOperationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LtrServerBackupOperationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/capabilitiesByLocation.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/capabilitiesByLocation.ts deleted file mode 100644 index b728b50bf522..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/capabilitiesByLocation.ts +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { CapabilitiesByLocation } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - Capability, - CapabilitiesByLocationListNextOptionalParams, - CapabilitiesByLocationListOptionalParams, - CapabilitiesByLocationListResponse, - CapabilitiesByLocationListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing CapabilitiesByLocation operations. */ -export class CapabilitiesByLocationImpl implements CapabilitiesByLocation { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class CapabilitiesByLocation class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists the capabilities available in a given location for a specific subscription. - * @param locationName The name of the location. - * @param options The options parameters. - */ - public list( - locationName: string, - options?: CapabilitiesByLocationListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(locationName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(locationName, options, settings); - }, - }; - } - - private async *listPagingPage( - locationName: string, - options?: CapabilitiesByLocationListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CapabilitiesByLocationListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(locationName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(locationName, continuationToken, options); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - locationName: string, - options?: CapabilitiesByLocationListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(locationName, options)) { - yield* page; - } - } - - /** - * Lists the capabilities available in a given location for a specific subscription. - * @param locationName The name of the location. - * @param options The options parameters. - */ - private _list( - locationName: string, - options?: CapabilitiesByLocationListOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ locationName, options }, listOperationSpec); - } - - /** - * ListNext - * @param locationName The name of the location. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - locationName: string, - nextLink: string, - options?: CapabilitiesByLocationListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapabilityList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId, Parameters.locationName], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapabilityList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.locationName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/capabilitiesByServer.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/capabilitiesByServer.ts deleted file mode 100644 index 18708fb97d9b..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/capabilitiesByServer.ts +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { CapabilitiesByServer } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - Capability, - CapabilitiesByServerListNextOptionalParams, - CapabilitiesByServerListOptionalParams, - CapabilitiesByServerListResponse, - CapabilitiesByServerListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing CapabilitiesByServer operations. */ -export class CapabilitiesByServerImpl implements CapabilitiesByServer { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class CapabilitiesByServer class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists the capabilities available for a given server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public list( - resourceGroupName: string, - serverName: string, - options?: CapabilitiesByServerListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listPagingPage( - resourceGroupName: string, - serverName: string, - options?: CapabilitiesByServerListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CapabilitiesByServerListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(resourceGroupName, serverName, continuationToken, options); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - resourceGroupName: string, - serverName: string, - options?: CapabilitiesByServerListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Lists the capabilities available for a given server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _list( - resourceGroupName: string, - serverName: string, - options?: CapabilitiesByServerListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listOperationSpec, - ); - } - - /** - * ListNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: CapabilitiesByServerListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/capabilities", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapabilityList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapabilityList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/capturedLogs.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/capturedLogs.ts deleted file mode 100644 index d10562c5be68..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/capturedLogs.ts +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { CapturedLogs } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - CapturedLog, - CapturedLogsListByServerNextOptionalParams, - CapturedLogsListByServerOptionalParams, - CapturedLogsListByServerResponse, - CapturedLogsListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing CapturedLogs operations. */ -export class CapturedLogsImpl implements CapturedLogs { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class CapturedLogs class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists all captured logs for download in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: CapturedLogsListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: CapturedLogsListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CapturedLogsListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: CapturedLogsListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Lists all captured logs for download in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: CapturedLogsListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: CapturedLogsListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/logFiles", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapturedLogList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CapturedLogList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/configurations.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/configurations.ts deleted file mode 100644 index 13c0aab7e050..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/configurations.ts +++ /dev/null @@ -1,511 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { Configurations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - Configuration, - ConfigurationsListByServerNextOptionalParams, - ConfigurationsListByServerOptionalParams, - ConfigurationsListByServerResponse, - ConfigurationsGetOptionalParams, - ConfigurationsGetResponse, - ConfigurationForUpdate, - ConfigurationsUpdateOptionalParams, - ConfigurationsUpdateResponse, - ConfigurationsPutOptionalParams, - ConfigurationsPutResponse, - ConfigurationsListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Configurations operations. */ -export class ConfigurationsImpl implements Configurations { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class Configurations class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists all configurations (also known as server parameters) of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: ConfigurationsListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: ConfigurationsListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ConfigurationsListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: ConfigurationsListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Lists all configurations (also known as server parameters) of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: ConfigurationsListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * Gets information about a specific configuration (also known as server parameter) of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - configurationName: string, - options?: ConfigurationsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, configurationName, options }, - getOperationSpec, - ); - } - - /** - * Updates the value assigned to a specific modifiable configuration (also known as server parameter) - * of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param parameters Parameters required to update the value of a specific modifiable configuration - * (also known as server parameter). - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - serverName: string, - configurationName: string, - parameters: ConfigurationForUpdate, - options?: ConfigurationsUpdateOptionalParams, - ): Promise< - SimplePollerLike, ConfigurationsUpdateResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - serverName, - configurationName, - parameters, - options, - }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - ConfigurationsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Updates the value assigned to a specific modifiable configuration (also known as server parameter) - * of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param parameters Parameters required to update the value of a specific modifiable configuration - * (also known as server parameter). - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - serverName: string, - configurationName: string, - parameters: ConfigurationForUpdate, - options?: ConfigurationsUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - serverName, - configurationName, - parameters, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as - * server parameter) of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param parameters Parameters required to update the value of a specific modifiable configuration - * (also known as server parameter). - * @param options The options parameters. - */ - async beginPut( - resourceGroupName: string, - serverName: string, - configurationName: string, - parameters: ConfigurationForUpdate, - options?: ConfigurationsPutOptionalParams, - ): Promise< - SimplePollerLike, ConfigurationsPutResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - serverName, - configurationName, - parameters, - options, - }, - spec: putOperationSpec, - }); - const poller = await createHttpPoller< - ConfigurationsPutResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as - * server parameter) of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param parameters Parameters required to update the value of a specific modifiable configuration - * (also known as server parameter). - * @param options The options parameters. - */ - async beginPutAndWait( - resourceGroupName: string, - serverName: string, - configurationName: string, - parameters: ConfigurationForUpdate, - options?: ConfigurationsPutOptionalParams, - ): Promise { - const poller = await this.beginPut( - resourceGroupName, - serverName, - configurationName, - parameters, - options, - ); - return poller.pollUntilDone(); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: ConfigurationsListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ConfigurationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Configuration, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.configurationName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Configuration, - }, - 201: { - bodyMapper: Mappers.Configuration, - }, - 202: { - bodyMapper: Mappers.Configuration, - }, - 204: { - bodyMapper: Mappers.Configuration, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters2, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.configurationName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const putOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Configuration, - }, - 201: { - bodyMapper: Mappers.Configuration, - }, - 202: { - bodyMapper: Mappers.Configuration, - }, - 204: { - bodyMapper: Mappers.Configuration, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters2, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.configurationName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ConfigurationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/databases.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/databases.ts deleted file mode 100644 index 0fcb5dc95bf8..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/databases.ts +++ /dev/null @@ -1,485 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { Databases } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - Database, - DatabasesListByServerNextOptionalParams, - DatabasesListByServerOptionalParams, - DatabasesListByServerResponse, - DatabasesCreateOptionalParams, - DatabasesCreateResponse, - DatabasesDeleteOptionalParams, - DatabasesDeleteResponse, - DatabasesGetOptionalParams, - DatabasesGetResponse, - DatabasesListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Databases operations. */ -export class DatabasesImpl implements Databases { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class Databases class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists all databases in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: DatabasesListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: DatabasesListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: DatabasesListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: DatabasesListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Creates a new database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param parameters Parameters required to create a new database. - * @param options The options parameters. - */ - async beginCreate( - resourceGroupName: string, - serverName: string, - databaseName: string, - parameters: Database, - options?: DatabasesCreateOptionalParams, - ): Promise, DatabasesCreateResponse>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - serverName, - databaseName, - parameters, - options, - }, - spec: createOperationSpec, - }); - const poller = await createHttpPoller< - DatabasesCreateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Creates a new database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param parameters Parameters required to create a new database. - * @param options The options parameters. - */ - async beginCreateAndWait( - resourceGroupName: string, - serverName: string, - databaseName: string, - parameters: Database, - options?: DatabasesCreateOptionalParams, - ): Promise { - const poller = await this.beginCreate( - resourceGroupName, - serverName, - databaseName, - parameters, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Deletes an existing database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - serverName: string, - databaseName: string, - options?: DatabasesDeleteOptionalParams, - ): Promise, DatabasesDeleteResponse>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, databaseName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - DatabasesDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Deletes an existing database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - databaseName: string, - options?: DatabasesDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete(resourceGroupName, serverName, databaseName, options); - return poller.pollUntilDone(); - } - - /** - * Gets information about an existing database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - databaseName: string, - options?: DatabasesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, databaseName, options }, - getOperationSpec, - ); - } - - /** - * Lists all databases in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: DatabasesListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: DatabasesListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Database, - }, - 201: { - bodyMapper: Mappers.Database, - }, - 202: { - bodyMapper: Mappers.Database, - }, - 204: { - bodyMapper: Mappers.Database, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters3, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.databaseName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.DatabasesDeleteHeaders, - }, - 201: { - headersMapper: Mappers.DatabasesDeleteHeaders, - }, - 202: { - headersMapper: Mappers.DatabasesDeleteHeaders, - }, - 204: { - headersMapper: Mappers.DatabasesDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.databaseName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Database, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.databaseName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatabaseList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DatabaseList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/firewallRules.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/firewallRules.ts deleted file mode 100644 index e1529a3a3d41..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/firewallRules.ts +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { FirewallRules } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - FirewallRule, - FirewallRulesListByServerNextOptionalParams, - FirewallRulesListByServerOptionalParams, - FirewallRulesListByServerResponse, - FirewallRulesCreateOrUpdateOptionalParams, - FirewallRulesCreateOrUpdateResponse, - FirewallRulesDeleteOptionalParams, - FirewallRulesDeleteResponse, - FirewallRulesGetOptionalParams, - FirewallRulesGetResponse, - FirewallRulesListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing FirewallRules operations. */ -export class FirewallRulesImpl implements FirewallRules { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class FirewallRules class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists information about all firewall rules in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: FirewallRulesListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: FirewallRulesListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: FirewallRulesListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: FirewallRulesListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Creates a new firewall rule or updates an existing firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param parameters Parameters required for creating or updating a firewall rule. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - parameters: FirewallRule, - options?: FirewallRulesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - FirewallRulesCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - serverName, - firewallRuleName, - parameters, - options, - }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - FirewallRulesCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Creates a new firewall rule or updates an existing firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param parameters Parameters required for creating or updating a firewall rule. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - parameters: FirewallRule, - options?: FirewallRulesCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - serverName, - firewallRuleName, - parameters, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Deletes an existing firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - options?: FirewallRulesDeleteOptionalParams, - ): Promise< - SimplePollerLike, FirewallRulesDeleteResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, firewallRuleName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - FirewallRulesDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Deletes an existing firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - options?: FirewallRulesDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete(resourceGroupName, serverName, firewallRuleName, options); - return poller.pollUntilDone(); - } - - /** - * Gets information about a firewall rule in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - options?: FirewallRulesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, firewallRuleName, options }, - getOperationSpec, - ); - } - - /** - * Lists information about all firewall rules in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: FirewallRulesListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: FirewallRulesListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.FirewallRule, - }, - 201: { - bodyMapper: Mappers.FirewallRule, - }, - 202: { - bodyMapper: Mappers.FirewallRule, - }, - 204: { - bodyMapper: Mappers.FirewallRule, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters4, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.firewallRuleName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.FirewallRulesDeleteHeaders, - }, - 201: { - headersMapper: Mappers.FirewallRulesDeleteHeaders, - }, - 202: { - headersMapper: Mappers.FirewallRulesDeleteHeaders, - }, - 204: { - headersMapper: Mappers.FirewallRulesDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.firewallRuleName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.FirewallRule, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.firewallRuleName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.FirewallRuleList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.FirewallRuleList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/index.ts deleted file mode 100644 index de4b64db15f7..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -export * from "./administratorsMicrosoftEntra.js"; -export * from "./advancedThreatProtectionSettings.js"; -export * from "./serverThreatProtectionSettings.js"; -export * from "./backupsAutomaticAndOnDemand.js"; -export * from "./capabilitiesByLocation.js"; -export * from "./capabilitiesByServer.js"; -export * from "./capturedLogs.js"; -export * from "./configurations.js"; -export * from "./databases.js"; -export * from "./firewallRules.js"; -export * from "./backupsLongTermRetention.js"; -export * from "./migrations.js"; -export * from "./nameAvailability.js"; -export * from "./operations.js"; -export * from "./privateDnsZoneSuffix.js"; -export * from "./privateEndpointConnections.js"; -export * from "./privateLinkResources.js"; -export * from "./quotaUsages.js"; -export * from "./replicas.js"; -export * from "./servers.js"; -export * from "./tuningOptionsOperations.js"; -export * from "./virtualEndpoints.js"; -export * from "./virtualNetworkSubnetUsage.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/migrations.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/migrations.ts deleted file mode 100644 index 5c5f390782a9..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/migrations.ts +++ /dev/null @@ -1,417 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { Migrations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - Migration, - MigrationsListByTargetServerNextOptionalParams, - MigrationsListByTargetServerOptionalParams, - MigrationsListByTargetServerResponse, - MigrationsCreateOptionalParams, - MigrationsCreateResponse, - MigrationsGetOptionalParams, - MigrationsGetResponse, - MigrationResourceForPatch, - MigrationsUpdateOptionalParams, - MigrationsUpdateResponse, - MigrationsCancelOptionalParams, - MigrationsCancelResponse, - MigrationNameAvailability, - MigrationsCheckNameAvailabilityOptionalParams, - MigrationsCheckNameAvailabilityResponse, - MigrationsListByTargetServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Migrations operations. */ -export class MigrationsImpl implements Migrations { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class Migrations class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists all migrations of a target flexible server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByTargetServer( - resourceGroupName: string, - serverName: string, - options?: MigrationsListByTargetServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByTargetServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByTargetServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByTargetServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: MigrationsListByTargetServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: MigrationsListByTargetServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByTargetServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByTargetServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByTargetServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: MigrationsListByTargetServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByTargetServerPagingPage( - resourceGroupName, - serverName, - options, - )) { - yield* page; - } - } - - /** - * Creates a new migration. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param migrationName Name of migration. - * @param parameters Parameters required for creating a migration. - * @param options The options parameters. - */ - create( - resourceGroupName: string, - serverName: string, - migrationName: string, - parameters: Migration, - options?: MigrationsCreateOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, migrationName, parameters, options }, - createOperationSpec, - ); - } - - /** - * Gets information about a migration. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param migrationName Name of migration. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - migrationName: string, - options?: MigrationsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, migrationName, options }, - getOperationSpec, - ); - } - - /** - * Updates an existing migration. The request body can contain one to many of the mutable properties - * present in the migration definition. Certain property updates initiate migration state transitions. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param migrationName Name of migration. - * @param parameters Parameters required to update an existing migration. - * @param options The options parameters. - */ - update( - resourceGroupName: string, - serverName: string, - migrationName: string, - parameters: MigrationResourceForPatch, - options?: MigrationsUpdateOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, migrationName, parameters, options }, - updateOperationSpec, - ); - } - - /** - * Cancels an active migration. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param migrationName Name of migration. - * @param options The options parameters. - */ - cancel( - resourceGroupName: string, - serverName: string, - migrationName: string, - options?: MigrationsCancelOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, migrationName, options }, - cancelOperationSpec, - ); - } - - /** - * Lists all migrations of a target flexible server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByTargetServer( - resourceGroupName: string, - serverName: string, - options?: MigrationsListByTargetServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByTargetServerOperationSpec, - ); - } - - /** - * Checks if a proposed migration name is valid and available. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to check if a migration name is valid and available. - * @param options The options parameters. - */ - checkNameAvailability( - resourceGroupName: string, - serverName: string, - parameters: MigrationNameAvailability, - options?: MigrationsCheckNameAvailabilityOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, parameters, options }, - checkNameAvailabilityOperationSpec, - ); - } - - /** - * ListByTargetServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByTargetServer method. - * @param options The options parameters. - */ - private _listByTargetServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: MigrationsListByTargetServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByTargetServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Migration, - }, - 201: { - bodyMapper: Mappers.Migration, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters7, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.migrationName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Migration, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.migrationName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Migration, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters8, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.migrationName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const cancelOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}", - httpMethod: "DELETE", - responses: { - 200: { - bodyMapper: Mappers.Migration, - }, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.migrationName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByTargetServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MigrationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion, Parameters.migrationListFilter], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/checkMigrationNameAvailability", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.MigrationNameAvailability, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters9, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const listByTargetServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MigrationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/nameAvailability.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/nameAvailability.ts deleted file mode 100644 index 29a8b78fcd7b..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/nameAvailability.ts +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { NameAvailability } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - CheckNameAvailabilityRequest, - NameAvailabilityCheckGloballyOptionalParams, - NameAvailabilityCheckGloballyResponse, - NameAvailabilityCheckWithLocationOptionalParams, - NameAvailabilityCheckWithLocationResponse, -} from "../models/index.js"; - -/** Class containing NameAvailability operations. */ -export class NameAvailabilityImpl implements NameAvailability { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class NameAvailability class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Checks the validity and availability of the given name, to assign it to a new server or to use it as - * the base name of a new pair of virtual endpoints. - * @param parameters Parameters required to check if a given name is valid and available to assign it - * to a new server or to use it as the base name of a new pair of virtual endpoints. - * @param options The options parameters. - */ - checkGlobally( - parameters: CheckNameAvailabilityRequest, - options?: NameAvailabilityCheckGloballyOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ parameters, options }, checkGloballyOperationSpec); - } - - /** - * Check the availability of name for resource - * @param locationName The name of the location. - * @param parameters Parameters required to check if a given name is valid and available to assign it - * to a new server or to use it as the base name of a new pair of virtual endpoints. - * @param options The options parameters. - */ - checkWithLocation( - locationName: string, - parameters: CheckNameAvailabilityRequest, - options?: NameAvailabilityCheckWithLocationOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, parameters, options }, - checkWithLocationOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const checkGloballyOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.NameAvailabilityModel, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters10, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const checkWithLocationOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.NameAvailabilityModel, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters10, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId, Parameters.locationName], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/operations.ts deleted file mode 100644 index 32209f5070c5..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/operations.ts +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { Operations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - Operation, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists all available REST API operations. - * @param options The options parameters. - */ - public list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - }, - }; - } - - private async *listPagingPage( - options?: OperationsListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: OperationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: OperationsListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * Lists all available REST API operations. - * @param options The options parameters. - */ - private _list(options?: OperationsListOptionalParams): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: OperationsListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.DBforPostgreSQL/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/privateDnsZoneSuffix.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/privateDnsZoneSuffix.ts deleted file mode 100644 index c15bc6e8dce4..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/privateDnsZoneSuffix.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PrivateDnsZoneSuffix } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - PrivateDnsZoneSuffixGetOptionalParams, - PrivateDnsZoneSuffixGetResponse, -} from "../models/index.js"; - -/** Class containing PrivateDnsZoneSuffix operations. */ -export class PrivateDnsZoneSuffixImpl implements PrivateDnsZoneSuffix { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class PrivateDnsZoneSuffix class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Gets the private DNS zone suffix. - * @param options The options parameters. - */ - get(options?: PrivateDnsZoneSuffixGetOptionalParams): Promise { - return this.client.sendOperationRequest({ options }, getOperationSpec); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: { type: { name: "String" } }, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/privateEndpointConnections.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/privateEndpointConnections.ts deleted file mode 100644 index cfeef983f8ca..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/privateEndpointConnections.ts +++ /dev/null @@ -1,500 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { PrivateEndpointConnections } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - PrivateEndpointConnection, - PrivateEndpointConnectionsListByServerNextOptionalParams, - PrivateEndpointConnectionsListByServerOptionalParams, - PrivateEndpointConnectionsListByServerResponse, - PrivateEndpointConnectionsGetOptionalParams, - PrivateEndpointConnectionsGetResponse, - PrivateEndpointConnectionsUpdateOptionalParams, - PrivateEndpointConnectionsUpdateResponse, - PrivateEndpointConnectionsDeleteOptionalParams, - PrivateEndpointConnectionsDeleteResponse, - PrivateEndpointConnectionsListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing PrivateEndpointConnections operations. */ -export class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class PrivateEndpointConnections class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists all private endpoint connections on a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: PrivateEndpointConnectionsListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: PrivateEndpointConnectionsListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: PrivateEndpointConnectionsListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: PrivateEndpointConnectionsListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Gets a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, privateEndpointConnectionName, options }, - getOperationSpec, - ); - } - - /** - * Approves or rejects a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param parameters Parameters required to update a private endpoint connection. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - parameters: PrivateEndpointConnection, - options?: PrivateEndpointConnectionsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - serverName, - privateEndpointConnectionName, - parameters, - options, - }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - PrivateEndpointConnectionsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Approves or rejects a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param parameters Parameters required to update a private endpoint connection. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - parameters: PrivateEndpointConnection, - options?: PrivateEndpointConnectionsUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - serverName, - privateEndpointConnectionName, - parameters, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Deletes a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsDeleteResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - serverName, - privateEndpointConnectionName, - options, - }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - PrivateEndpointConnectionsDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Deletes a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - serverName, - privateEndpointConnectionName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Lists all private endpoint connections on a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: PrivateEndpointConnectionsListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: PrivateEndpointConnectionsListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.privateEndpointConnectionName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - 201: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - 202: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - 204: { - bodyMapper: Mappers.PrivateEndpointConnection, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters11, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.privateEndpointConnectionName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, - }, - 201: { - headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, - }, - 202: { - headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, - }, - 204: { - headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.privateEndpointConnectionName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnectionList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnectionList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/privateLinkResources.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/privateLinkResources.ts deleted file mode 100644 index a15e35b0c0cb..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/privateLinkResources.ts +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { PrivateLinkResources } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - PrivateLinkResource, - PrivateLinkResourcesListByServerNextOptionalParams, - PrivateLinkResourcesListByServerOptionalParams, - PrivateLinkResourcesListByServerResponse, - PrivateLinkResourcesGetOptionalParams, - PrivateLinkResourcesGetResponse, - PrivateLinkResourcesListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing PrivateLinkResources operations. */ -export class PrivateLinkResourcesImpl implements PrivateLinkResources { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class PrivateLinkResources class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Gets the private link resources for PostgreSQL server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: PrivateLinkResourcesListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: PrivateLinkResourcesListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: PrivateLinkResourcesListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: PrivateLinkResourcesListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Gets the private link resources for PostgreSQL server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: PrivateLinkResourcesListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * Gets a private link resource for PostgreSQL server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param groupName The name of the private link resource. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - groupName: string, - options?: PrivateLinkResourcesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, groupName, options }, - getOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: PrivateLinkResourcesListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateLinkResourceList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources/{groupName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateLinkResource, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.groupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateLinkResourceList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/quotaUsages.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/quotaUsages.ts deleted file mode 100644 index 49ec540f202f..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/quotaUsages.ts +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { QuotaUsages } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - QuotaUsage, - QuotaUsagesListNextOptionalParams, - QuotaUsagesListOptionalParams, - QuotaUsagesListResponse, - QuotaUsagesListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing QuotaUsages operations. */ -export class QuotaUsagesImpl implements QuotaUsages { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class QuotaUsages class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Get quota usages at specified location in a given subscription. - * @param locationName The name of the location. - * @param options The options parameters. - */ - public list( - locationName: string, - options?: QuotaUsagesListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(locationName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(locationName, options, settings); - }, - }; - } - - private async *listPagingPage( - locationName: string, - options?: QuotaUsagesListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: QuotaUsagesListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(locationName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(locationName, continuationToken, options); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - locationName: string, - options?: QuotaUsagesListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(locationName, options)) { - yield* page; - } - } - - /** - * Get quota usages at specified location in a given subscription. - * @param locationName The name of the location. - * @param options The options parameters. - */ - private _list( - locationName: string, - options?: QuotaUsagesListOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ locationName, options }, listOperationSpec); - } - - /** - * ListNext - * @param locationName The name of the location. - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - locationName: string, - nextLink: string, - options?: QuotaUsagesListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/resourceType/flexibleServers/usages", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.QuotaUsageList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId, Parameters.locationName], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.QuotaUsageList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.nextLink, - Parameters.locationName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/replicas.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/replicas.ts deleted file mode 100644 index 1d4bc75588f2..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/replicas.ts +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import type { Replicas } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - Server, - ReplicasListByServerOptionalParams, - ReplicasListByServerResponse, -} from "../models/index.js"; - -/// -/** Class containing Replicas operations. */ -export class ReplicasImpl implements Replicas { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class Replicas class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists all read replicas of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: ReplicasListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: ReplicasListByServerOptionalParams, - _settings?: PageSettings, - ): AsyncIterableIterator { - let result: ReplicasListByServerResponse; - result = await this._listByServer(resourceGroupName, serverName, options); - yield result.value || []; - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: ReplicasListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Lists all read replicas of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: ReplicasListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/replicas", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ServerList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/serverThreatProtectionSettings.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/serverThreatProtectionSettings.ts deleted file mode 100644 index bd12086a2057..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/serverThreatProtectionSettings.ts +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { ServerThreatProtectionSettings } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - ThreatProtectionName, - AdvancedThreatProtectionSettingsModel, - ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, - ServerThreatProtectionSettingsCreateOrUpdateResponse, -} from "../models/index.js"; - -/** Class containing ServerThreatProtectionSettings operations. */ -export class ServerThreatProtectionSettingsImpl implements ServerThreatProtectionSettings { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class ServerThreatProtectionSettings class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Creates or updates a server's Advanced Threat Protection settings. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param threatProtectionName Name of the advanced threat protection settings. - * @param parameters The Advanced Threat Protection state for the server. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - serverName: string, - threatProtectionName: ThreatProtectionName, - parameters: AdvancedThreatProtectionSettingsModel, - options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ServerThreatProtectionSettingsCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - serverName, - threatProtectionName, - parameters, - options, - }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - ServerThreatProtectionSettingsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Creates or updates a server's Advanced Threat Protection settings. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param threatProtectionName Name of the advanced threat protection settings. - * @param parameters The Advanced Threat Protection state for the server. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - serverName: string, - threatProtectionName: ThreatProtectionName, - parameters: AdvancedThreatProtectionSettingsModel, - options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - serverName, - threatProtectionName, - parameters, - options, - ); - return poller.pollUntilDone(); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.AdvancedThreatProtectionSettingsModel, - }, - 201: { - bodyMapper: Mappers.AdvancedThreatProtectionSettingsModel, - }, - 202: { - bodyMapper: Mappers.AdvancedThreatProtectionSettingsModel, - }, - 204: { - bodyMapper: Mappers.AdvancedThreatProtectionSettingsModel, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.threatProtectionName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/servers.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/servers.ts deleted file mode 100644 index db0deb42d687..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/servers.ts +++ /dev/null @@ -1,1016 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { Servers } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - Server, - ServersListByResourceGroupNextOptionalParams, - ServersListByResourceGroupOptionalParams, - ServersListByResourceGroupResponse, - ServersListBySubscriptionNextOptionalParams, - ServersListBySubscriptionOptionalParams, - ServersListBySubscriptionResponse, - ServersCreateOrUpdateOptionalParams, - ServersCreateOrUpdateResponse, - ServerForPatch, - ServersUpdateOptionalParams, - ServersUpdateResponse, - ServersDeleteOptionalParams, - ServersDeleteResponse, - ServersGetOptionalParams, - ServersGetResponse, - ServersRestartOptionalParams, - ServersRestartResponse, - ServersStartOptionalParams, - ServersStartResponse, - ServersStopOptionalParams, - ServersStopResponse, - ServersListByResourceGroupNextResponse, - ServersListBySubscriptionNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Servers operations. */ -export class ServersImpl implements Servers { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class Servers class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists all servers in a resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - public listByResourceGroup( - resourceGroupName: string, - options?: ServersListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByResourceGroupPagingPage(resourceGroupName, options, settings); - }, - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroupName: string, - options?: ServersListByResourceGroupOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ServersListByResourceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByResourceGroup(resourceGroupName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByResourceGroupNext(resourceGroupName, continuationToken, options); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByResourceGroupPagingAll( - resourceGroupName: string, - options?: ServersListByResourceGroupOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage(resourceGroupName, options)) { - yield* page; - } - } - - /** - * Lists all servers in a subscription. - * @param options The options parameters. - */ - public listBySubscription( - options?: ServersListBySubscriptionOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listBySubscriptionPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listBySubscriptionPagingPage(options, settings); - }, - }; - } - - private async *listBySubscriptionPagingPage( - options?: ServersListBySubscriptionOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ServersListBySubscriptionResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listBySubscription(options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listBySubscriptionNext(continuationToken, options); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listBySubscriptionPagingAll( - options?: ServersListBySubscriptionOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listBySubscriptionPagingPage(options)) { - yield* page; - } - } - - /** - * Creates a new server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to create a new server or to update an existing server. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - serverName: string, - parameters: Server, - options?: ServersCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike, ServersCreateOrUpdateResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, parameters, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - ServersCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Creates a new server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to create a new server or to update an existing server. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - serverName: string, - parameters: Server, - options?: ServersCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - serverName, - parameters, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Updates an existing server. The request body can contain one or multiple of the properties present - * in the normal server definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to update a server. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - serverName: string, - parameters: ServerForPatch, - options?: ServersUpdateOptionalParams, - ): Promise, ServersUpdateResponse>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, parameters, options }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - ServersUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Updates an existing server. The request body can contain one or multiple of the properties present - * in the normal server definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to update a server. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - serverName: string, - parameters: ServerForPatch, - options?: ServersUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate(resourceGroupName, serverName, parameters, options); - return poller.pollUntilDone(); - } - - /** - * Deletes or drops an existing server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - serverName: string, - options?: ServersDeleteOptionalParams, - ): Promise, ServersDeleteResponse>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - ServersDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Deletes or drops an existing server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - options?: ServersDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete(resourceGroupName, serverName, options); - return poller.pollUntilDone(); - } - - /** - * Gets information about an existing server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - options?: ServersGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - getOperationSpec, - ); - } - - /** - * Lists all servers in a resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - private _listByResourceGroup( - resourceGroupName: string, - options?: ServersListByResourceGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec, - ); - } - - /** - * Lists all servers in a subscription. - * @param options The options parameters. - */ - private _listBySubscription( - options?: ServersListBySubscriptionOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, listBySubscriptionOperationSpec); - } - - /** - * Restarts PostgreSQL database engine in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - async beginRestart( - resourceGroupName: string, - serverName: string, - options?: ServersRestartOptionalParams, - ): Promise, ServersRestartResponse>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, options }, - spec: restartOperationSpec, - }); - const poller = await createHttpPoller< - ServersRestartResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Restarts PostgreSQL database engine in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - async beginRestartAndWait( - resourceGroupName: string, - serverName: string, - options?: ServersRestartOptionalParams, - ): Promise { - const poller = await this.beginRestart(resourceGroupName, serverName, options); - return poller.pollUntilDone(); - } - - /** - * Starts a stopped server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - async beginStart( - resourceGroupName: string, - serverName: string, - options?: ServersStartOptionalParams, - ): Promise, ServersStartResponse>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, options }, - spec: startOperationSpec, - }); - const poller = await createHttpPoller< - ServersStartResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Starts a stopped server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - async beginStartAndWait( - resourceGroupName: string, - serverName: string, - options?: ServersStartOptionalParams, - ): Promise { - const poller = await this.beginStart(resourceGroupName, serverName, options); - return poller.pollUntilDone(); - } - - /** - * Stops a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - async beginStop( - resourceGroupName: string, - serverName: string, - options?: ServersStopOptionalParams, - ): Promise, ServersStopResponse>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, options }, - spec: stopOperationSpec, - }); - const poller = await createHttpPoller>( - lro, - { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }, - ); - await poller.poll(); - return poller; - } - - /** - * Stops a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - async beginStopAndWait( - resourceGroupName: string, - serverName: string, - options?: ServersStopOptionalParams, - ): Promise { - const poller = await this.beginStop(resourceGroupName, serverName, options); - return poller.pollUntilDone(); - } - - /** - * ListByResourceGroupNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. - * @param options The options parameters. - */ - private _listByResourceGroupNext( - resourceGroupName: string, - nextLink: string, - options?: ServersListByResourceGroupNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec, - ); - } - - /** - * ListBySubscriptionNext - * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. - * @param options The options parameters. - */ - private _listBySubscriptionNext( - nextLink: string, - options?: ServersListBySubscriptionNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listBySubscriptionNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Server, - }, - 201: { - bodyMapper: Mappers.Server, - }, - 202: { - bodyMapper: Mappers.Server, - }, - 204: { - bodyMapper: Mappers.Server, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters12, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Server, - }, - 201: { - bodyMapper: Mappers.Server, - }, - 202: { - bodyMapper: Mappers.Server, - }, - 204: { - bodyMapper: Mappers.Server, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters13, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.ServersDeleteHeaders, - }, - 201: { - headersMapper: Mappers.ServersDeleteHeaders, - }, - 202: { - headersMapper: Mappers.ServersDeleteHeaders, - }, - 204: { - headersMapper: Mappers.ServersDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Server, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ServerList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName], - headerParameters: [Parameters.accept], - serializer, -}; -const listBySubscriptionOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ServerList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer, -}; -const restartOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart", - httpMethod: "POST", - responses: { - 200: { - headersMapper: Mappers.ServersRestartHeaders, - }, - 201: { - headersMapper: Mappers.ServersRestartHeaders, - }, - 202: { - headersMapper: Mappers.ServersRestartHeaders, - }, - 204: { - headersMapper: Mappers.ServersRestartHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters14, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const startOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start", - httpMethod: "POST", - responses: { - 200: { - headersMapper: Mappers.ServersStartHeaders, - }, - 201: { - headersMapper: Mappers.ServersStartHeaders, - }, - 202: { - headersMapper: Mappers.ServersStartHeaders, - }, - 204: { - headersMapper: Mappers.ServersStartHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const stopOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop", - httpMethod: "POST", - responses: { - 200: { - headersMapper: Mappers.ServersStopHeaders, - }, - 201: { - headersMapper: Mappers.ServersStopHeaders, - }, - 202: { - headersMapper: Mappers.ServersStopHeaders, - }, - 204: { - headersMapper: Mappers.ServersStopHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ServerList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ServerList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [Parameters.$host, Parameters.subscriptionId, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/tuningOptionsOperations.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/tuningOptionsOperations.ts deleted file mode 100644 index cf27c27724c6..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/tuningOptionsOperations.ts +++ /dev/null @@ -1,408 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { TuningOptionsOperations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - ObjectRecommendation, - TuningOptionParameterEnum, - TuningOptionsListRecommendationsNextOptionalParams, - TuningOptionsListRecommendationsOptionalParams, - TuningOptionsListRecommendationsResponse, - TuningOptions, - TuningOptionsListByServerNextOptionalParams, - TuningOptionsListByServerOptionalParams, - TuningOptionsListByServerResponse, - TuningOptionsGetOptionalParams, - TuningOptionsGetResponse, - TuningOptionsListRecommendationsNextResponse, - TuningOptionsListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing TuningOptionsOperations operations. */ -export class TuningOptionsOperationsImpl implements TuningOptionsOperations { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class TuningOptionsOperations class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists available object recommendations. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param tuningOption The name of the tuning option. - * @param options The options parameters. - */ - public listRecommendations( - resourceGroupName: string, - serverName: string, - tuningOption: TuningOptionParameterEnum, - options?: TuningOptionsListRecommendationsOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listRecommendationsPagingAll( - resourceGroupName, - serverName, - tuningOption, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listRecommendationsPagingPage( - resourceGroupName, - serverName, - tuningOption, - options, - settings, - ); - }, - }; - } - - private async *listRecommendationsPagingPage( - resourceGroupName: string, - serverName: string, - tuningOption: TuningOptionParameterEnum, - options?: TuningOptionsListRecommendationsOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: TuningOptionsListRecommendationsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listRecommendations( - resourceGroupName, - serverName, - tuningOption, - options, - ); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listRecommendationsNext( - resourceGroupName, - serverName, - tuningOption, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listRecommendationsPagingAll( - resourceGroupName: string, - serverName: string, - tuningOption: TuningOptionParameterEnum, - options?: TuningOptionsListRecommendationsOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listRecommendationsPagingPage( - resourceGroupName, - serverName, - tuningOption, - options, - )) { - yield* page; - } - } - - /** - * Lists the tuning options of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: TuningOptionsListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: TuningOptionsListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: TuningOptionsListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: TuningOptionsListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Gets the tuning options of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param tuningOption The name of the tuning option. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - tuningOption: TuningOptionParameterEnum, - options?: TuningOptionsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, tuningOption, options }, - getOperationSpec, - ); - } - - /** - * Lists available object recommendations. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param tuningOption The name of the tuning option. - * @param options The options parameters. - */ - private _listRecommendations( - resourceGroupName: string, - serverName: string, - tuningOption: TuningOptionParameterEnum, - options?: TuningOptionsListRecommendationsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, tuningOption, options }, - listRecommendationsOperationSpec, - ); - } - - /** - * Lists the tuning options of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: TuningOptionsListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * ListRecommendationsNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param tuningOption The name of the tuning option. - * @param nextLink The nextLink from the previous successful call to the ListRecommendations method. - * @param options The options parameters. - */ - private _listRecommendationsNext( - resourceGroupName: string, - serverName: string, - tuningOption: TuningOptionParameterEnum, - nextLink: string, - options?: TuningOptionsListRecommendationsNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, tuningOption, nextLink, options }, - listRecommendationsNextOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: TuningOptionsListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.TuningOptions, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.tuningOption, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listRecommendationsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ObjectRecommendationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion, Parameters.recommendationType], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.tuningOption, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.TuningOptionsList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listRecommendationsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ObjectRecommendationList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - Parameters.tuningOption, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.TuningOptionsList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/virtualEndpoints.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/virtualEndpoints.ts deleted file mode 100644 index 7b056c260cbc..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/virtualEndpoints.ts +++ /dev/null @@ -1,627 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import type { VirtualEndpoints } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import type { - VirtualEndpoint, - VirtualEndpointsListByServerNextOptionalParams, - VirtualEndpointsListByServerOptionalParams, - VirtualEndpointsListByServerResponse, - VirtualEndpointsCreateOptionalParams, - VirtualEndpointsCreateResponse, - VirtualEndpointResourceForPatch, - VirtualEndpointsUpdateOptionalParams, - VirtualEndpointsUpdateResponse, - VirtualEndpointsDeleteOptionalParams, - VirtualEndpointsDeleteResponse, - VirtualEndpointsGetOptionalParams, - VirtualEndpointsGetResponse, - VirtualEndpointsListByServerNextResponse, -} from "../models/index.js"; - -/// -/** Class containing VirtualEndpoints operations. */ -export class VirtualEndpointsImpl implements VirtualEndpoints { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class VirtualEndpoints class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists pair of virtual endpoints associated to a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - public listByServer( - resourceGroupName: string, - serverName: string, - options?: VirtualEndpointsListByServerOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByServerPagingAll(resourceGroupName, serverName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByServerPagingPage(resourceGroupName, serverName, options, settings); - }, - }; - } - - private async *listByServerPagingPage( - resourceGroupName: string, - serverName: string, - options?: VirtualEndpointsListByServerOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: VirtualEndpointsListByServerResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByServer(resourceGroupName, serverName, options); - const page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByServerNext( - resourceGroupName, - serverName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - const page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByServerPagingAll( - resourceGroupName: string, - serverName: string, - options?: VirtualEndpointsListByServerOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByServerPagingPage(resourceGroupName, serverName, options)) { - yield* page; - } - } - - /** - * Creates a pair of virtual endpoints for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param parameters Parameters required to create or update a pair of virtual endpoints. - * @param options The options parameters. - */ - async beginCreate( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - parameters: VirtualEndpoint, - options?: VirtualEndpointsCreateOptionalParams, - ): Promise< - SimplePollerLike, VirtualEndpointsCreateResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - serverName, - virtualEndpointName, - parameters, - options, - }, - spec: createOperationSpec, - }); - const poller = await createHttpPoller< - VirtualEndpointsCreateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Creates a pair of virtual endpoints for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param parameters Parameters required to create or update a pair of virtual endpoints. - * @param options The options parameters. - */ - async beginCreateAndWait( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - parameters: VirtualEndpoint, - options?: VirtualEndpointsCreateOptionalParams, - ): Promise { - const poller = await this.beginCreate( - resourceGroupName, - serverName, - virtualEndpointName, - parameters, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Updates a pair of virtual endpoints for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param parameters Parameters required to update a pair of virtual endpoints. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - parameters: VirtualEndpointResourceForPatch, - options?: VirtualEndpointsUpdateOptionalParams, - ): Promise< - SimplePollerLike, VirtualEndpointsUpdateResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - serverName, - virtualEndpointName, - parameters, - options, - }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - VirtualEndpointsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Updates a pair of virtual endpoints for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param parameters Parameters required to update a pair of virtual endpoints. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - parameters: VirtualEndpointResourceForPatch, - options?: VirtualEndpointsUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - serverName, - virtualEndpointName, - parameters, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Deletes a pair of virtual endpoints. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - options?: VirtualEndpointsDeleteOptionalParams, - ): Promise< - SimplePollerLike, VirtualEndpointsDeleteResponse> - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, serverName, virtualEndpointName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - VirtualEndpointsDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Deletes a pair of virtual endpoints. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - options?: VirtualEndpointsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - serverName, - virtualEndpointName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Gets information about a pair of virtual endpoints. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - options?: VirtualEndpointsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, virtualEndpointName, options }, - getOperationSpec, - ); - } - - /** - * Lists pair of virtual endpoints associated to a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - private _listByServer( - resourceGroupName: string, - serverName: string, - options?: VirtualEndpointsListByServerOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, options }, - listByServerOperationSpec, - ); - } - - /** - * ListByServerNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param nextLink The nextLink from the previous successful call to the ListByServer method. - * @param options The options parameters. - */ - private _listByServerNext( - resourceGroupName: string, - serverName: string, - nextLink: string, - options?: VirtualEndpointsListByServerNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, serverName, nextLink, options }, - listByServerNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const createOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.VirtualEndpoint, - }, - 201: { - bodyMapper: Mappers.VirtualEndpoint, - }, - 202: { - bodyMapper: Mappers.VirtualEndpoint, - }, - 204: { - bodyMapper: Mappers.VirtualEndpoint, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters15, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.virtualEndpointName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.VirtualEndpoint, - }, - 201: { - bodyMapper: Mappers.VirtualEndpoint, - }, - 202: { - bodyMapper: Mappers.VirtualEndpoint, - }, - 204: { - bodyMapper: Mappers.VirtualEndpoint, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters16, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.virtualEndpointName, - ], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.VirtualEndpointsDeleteHeaders, - }, - 201: { - headersMapper: Mappers.VirtualEndpointsDeleteHeaders, - }, - 202: { - headersMapper: Mappers.VirtualEndpointsDeleteHeaders, - }, - 204: { - headersMapper: Mappers.VirtualEndpointsDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.virtualEndpointName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.VirtualEndpoint, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.virtualEndpointName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.VirtualEndpointsList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByServerNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.VirtualEndpointsList, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.serverName, - Parameters.nextLink, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operations/virtualNetworkSubnetUsage.ts b/sdk/postgresql/arm-postgresql-flexible/src/operations/virtualNetworkSubnetUsage.ts deleted file mode 100644 index 68e1fc34fdbd..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operations/virtualNetworkSubnetUsage.ts +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { VirtualNetworkSubnetUsage } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import type { PostgreSQLManagementFlexibleServerClient } from "../postgreSQLManagementFlexibleServerClient.js"; -import type { - VirtualNetworkSubnetUsageParameter, - VirtualNetworkSubnetUsageListOptionalParams, - VirtualNetworkSubnetUsageListResponse, -} from "../models/index.js"; - -/** Class containing VirtualNetworkSubnetUsage operations. */ -export class VirtualNetworkSubnetUsageImpl implements VirtualNetworkSubnetUsage { - private readonly client: PostgreSQLManagementFlexibleServerClient; - - /** - * Initialize a new instance of the class VirtualNetworkSubnetUsage class. - * @param client Reference to the service client - */ - constructor(client: PostgreSQLManagementFlexibleServerClient) { - this.client = client; - } - - /** - * Lists the virtual network subnet usage for a given virtual network. - * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. - * @param options The options parameters. - */ - list( - locationName: string, - parameters: VirtualNetworkSubnetUsageParameter, - options?: VirtualNetworkSubnetUsageListOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { locationName, parameters, options }, - listOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.VirtualNetworkSubnetUsageModel, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.parameters17, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId, Parameters.locationName], - headerParameters: [Parameters.contentType, Parameters.accept], - mediaType: "json", - serializer, -}; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/administratorsMicrosoftEntra.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/administratorsMicrosoftEntra.ts deleted file mode 100644 index a5c7a1ed5f48..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/administratorsMicrosoftEntra.ts +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - AdministratorMicrosoftEntra, - AdministratorsMicrosoftEntraListByServerOptionalParams, - AdministratorMicrosoftEntraAdd, - AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, - AdministratorsMicrosoftEntraCreateOrUpdateResponse, - AdministratorsMicrosoftEntraDeleteOptionalParams, - AdministratorsMicrosoftEntraDeleteResponse, - AdministratorsMicrosoftEntraGetOptionalParams, - AdministratorsMicrosoftEntraGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a AdministratorsMicrosoftEntra. */ -export interface AdministratorsMicrosoftEntra { - /** - * List all server administrators associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: AdministratorsMicrosoftEntraListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Creates a new server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param parameters Required parameters for adding a server administrator associated to a Microsoft - * Entra principal. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - serverName: string, - objectId: string, - parameters: AdministratorMicrosoftEntraAdd, - options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AdministratorsMicrosoftEntraCreateOrUpdateResponse - > - >; - /** - * Creates a new server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param parameters Required parameters for adding a server administrator associated to a Microsoft - * Entra principal. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - serverName: string, - objectId: string, - parameters: AdministratorMicrosoftEntraAdd, - options?: AdministratorsMicrosoftEntraCreateOrUpdateOptionalParams, - ): Promise; - /** - * Deletes an existing server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - serverName: string, - objectId: string, - options?: AdministratorsMicrosoftEntraDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AdministratorsMicrosoftEntraDeleteResponse - > - >; - /** - * Deletes an existing server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - objectId: string, - options?: AdministratorsMicrosoftEntraDeleteOptionalParams, - ): Promise; - /** - * Gets information about a server administrator associated to a Microsoft Entra principal. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param objectId Object identifier of the Microsoft Entra principal. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - objectId: string, - options?: AdministratorsMicrosoftEntraGetOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/advancedThreatProtectionSettings.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/advancedThreatProtectionSettings.ts deleted file mode 100644 index b00907a3a9da..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/advancedThreatProtectionSettings.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { - AdvancedThreatProtectionSettingsModel, - AdvancedThreatProtectionSettingsListByServerOptionalParams, - ThreatProtectionName, - AdvancedThreatProtectionSettingsGetOptionalParams, - AdvancedThreatProtectionSettingsGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a AdvancedThreatProtectionSettings. */ -export interface AdvancedThreatProtectionSettings { - /** - * Lists state of advanced threat protection settings for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: AdvancedThreatProtectionSettingsListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Gets state of advanced threat protection settings for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param threatProtectionName Name of the advanced threat protection settings. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - threatProtectionName: ThreatProtectionName, - options?: AdvancedThreatProtectionSettingsGetOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/backupsAutomaticAndOnDemand.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/backupsAutomaticAndOnDemand.ts deleted file mode 100644 index 6375a0ef481c..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/backupsAutomaticAndOnDemand.ts +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - BackupAutomaticAndOnDemand, - BackupsAutomaticAndOnDemandListByServerOptionalParams, - BackupsAutomaticAndOnDemandCreateOptionalParams, - BackupsAutomaticAndOnDemandCreateResponse, - BackupsAutomaticAndOnDemandDeleteOptionalParams, - BackupsAutomaticAndOnDemandDeleteResponse, - BackupsAutomaticAndOnDemandGetOptionalParams, - BackupsAutomaticAndOnDemandGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a BackupsAutomaticAndOnDemand. */ -export interface BackupsAutomaticAndOnDemand { - /** - * Lists all available backups of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: BackupsAutomaticAndOnDemandListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Creates an on demand backup of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - beginCreate( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandCreateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - BackupsAutomaticAndOnDemandCreateResponse - > - >; - /** - * Creates an on demand backup of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - beginCreateAndWait( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandCreateOptionalParams, - ): Promise; - /** - * Deletes a specific backup, given its name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - BackupsAutomaticAndOnDemandDeleteResponse - > - >; - /** - * Deletes a specific backup, given its name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandDeleteOptionalParams, - ): Promise; - /** - * Gets information of an on demand backup, given its name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName Name of the backup. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsAutomaticAndOnDemandGetOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/backupsLongTermRetention.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/backupsLongTermRetention.ts deleted file mode 100644 index 40d6e11eb7d6..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/backupsLongTermRetention.ts +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - BackupsLongTermRetentionOperation, - BackupsLongTermRetentionListByServerOptionalParams, - LtrPreBackupRequest, - BackupsLongTermRetentionCheckPrerequisitesOptionalParams, - BackupsLongTermRetentionCheckPrerequisitesResponse, - BackupsLongTermRetentionRequest, - BackupsLongTermRetentionStartOptionalParams, - BackupsLongTermRetentionStartResponse, - BackupsLongTermRetentionGetOptionalParams, - BackupsLongTermRetentionGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a BackupsLongTermRetention. */ -export interface BackupsLongTermRetention { - /** - * Lists the results of the long term retention backup operations for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: BackupsLongTermRetentionListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Performs all checks required for a long term retention backup operation to succeed. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Request body for operation - * @param options The options parameters. - */ - checkPrerequisites( - resourceGroupName: string, - serverName: string, - parameters: LtrPreBackupRequest, - options?: BackupsLongTermRetentionCheckPrerequisitesOptionalParams, - ): Promise; - /** - * Initiates a long term retention backup. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Request body for operation - * @param options The options parameters. - */ - beginStart( - resourceGroupName: string, - serverName: string, - parameters: BackupsLongTermRetentionRequest, - options?: BackupsLongTermRetentionStartOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - BackupsLongTermRetentionStartResponse - > - >; - /** - * Initiates a long term retention backup. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Request body for operation - * @param options The options parameters. - */ - beginStartAndWait( - resourceGroupName: string, - serverName: string, - parameters: BackupsLongTermRetentionRequest, - options?: BackupsLongTermRetentionStartOptionalParams, - ): Promise; - /** - * Gets the results of a long retention backup operation for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param backupName The name of the backup. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - backupName: string, - options?: BackupsLongTermRetentionGetOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/capabilitiesByLocation.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/capabilitiesByLocation.ts deleted file mode 100644 index eb6b5baae24e..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/capabilitiesByLocation.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { Capability, CapabilitiesByLocationListOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a CapabilitiesByLocation. */ -export interface CapabilitiesByLocation { - /** - * Lists the capabilities available in a given location for a specific subscription. - * @param locationName The name of the location. - * @param options The options parameters. - */ - list( - locationName: string, - options?: CapabilitiesByLocationListOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/capabilitiesByServer.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/capabilitiesByServer.ts deleted file mode 100644 index 95ad494b7824..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/capabilitiesByServer.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { Capability, CapabilitiesByServerListOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a CapabilitiesByServer. */ -export interface CapabilitiesByServer { - /** - * Lists the capabilities available for a given server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - list( - resourceGroupName: string, - serverName: string, - options?: CapabilitiesByServerListOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/capturedLogs.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/capturedLogs.ts deleted file mode 100644 index 22286d690d79..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/capturedLogs.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { CapturedLog, CapturedLogsListByServerOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a CapturedLogs. */ -export interface CapturedLogs { - /** - * Lists all captured logs for download in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: CapturedLogsListByServerOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/configurations.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/configurations.ts deleted file mode 100644 index 6c8b02d1aa46..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/configurations.ts +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - Configuration, - ConfigurationsListByServerOptionalParams, - ConfigurationsGetOptionalParams, - ConfigurationsGetResponse, - ConfigurationForUpdate, - ConfigurationsUpdateOptionalParams, - ConfigurationsUpdateResponse, - ConfigurationsPutOptionalParams, - ConfigurationsPutResponse, -} from "../models/index.js"; - -/// -/** Interface representing a Configurations. */ -export interface Configurations { - /** - * Lists all configurations (also known as server parameters) of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: ConfigurationsListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Gets information about a specific configuration (also known as server parameter) of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - configurationName: string, - options?: ConfigurationsGetOptionalParams, - ): Promise; - /** - * Updates the value assigned to a specific modifiable configuration (also known as server parameter) - * of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param parameters Parameters required to update the value of a specific modifiable configuration - * (also known as server parameter). - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - serverName: string, - configurationName: string, - parameters: ConfigurationForUpdate, - options?: ConfigurationsUpdateOptionalParams, - ): Promise< - SimplePollerLike, ConfigurationsUpdateResponse> - >; - /** - * Updates the value assigned to a specific modifiable configuration (also known as server parameter) - * of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param parameters Parameters required to update the value of a specific modifiable configuration - * (also known as server parameter). - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - serverName: string, - configurationName: string, - parameters: ConfigurationForUpdate, - options?: ConfigurationsUpdateOptionalParams, - ): Promise; - /** - * Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as - * server parameter) of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param parameters Parameters required to update the value of a specific modifiable configuration - * (also known as server parameter). - * @param options The options parameters. - */ - beginPut( - resourceGroupName: string, - serverName: string, - configurationName: string, - parameters: ConfigurationForUpdate, - options?: ConfigurationsPutOptionalParams, - ): Promise< - SimplePollerLike, ConfigurationsPutResponse> - >; - /** - * Updates, using Put verb, the value assigned to a specific modifiable configuration (also known as - * server parameter) of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName Name of the configuration (also known as server parameter). - * @param parameters Parameters required to update the value of a specific modifiable configuration - * (also known as server parameter). - * @param options The options parameters. - */ - beginPutAndWait( - resourceGroupName: string, - serverName: string, - configurationName: string, - parameters: ConfigurationForUpdate, - options?: ConfigurationsPutOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/databases.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/databases.ts deleted file mode 100644 index cb0be69553d4..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/databases.ts +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - Database, - DatabasesListByServerOptionalParams, - DatabasesCreateOptionalParams, - DatabasesCreateResponse, - DatabasesDeleteOptionalParams, - DatabasesDeleteResponse, - DatabasesGetOptionalParams, - DatabasesGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a Databases. */ -export interface Databases { - /** - * Lists all databases in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: DatabasesListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Creates a new database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param parameters Parameters required to create a new database. - * @param options The options parameters. - */ - beginCreate( - resourceGroupName: string, - serverName: string, - databaseName: string, - parameters: Database, - options?: DatabasesCreateOptionalParams, - ): Promise, DatabasesCreateResponse>>; - /** - * Creates a new database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param parameters Parameters required to create a new database. - * @param options The options parameters. - */ - beginCreateAndWait( - resourceGroupName: string, - serverName: string, - databaseName: string, - parameters: Database, - options?: DatabasesCreateOptionalParams, - ): Promise; - /** - * Deletes an existing database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - serverName: string, - databaseName: string, - options?: DatabasesDeleteOptionalParams, - ): Promise, DatabasesDeleteResponse>>; - /** - * Deletes an existing database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - databaseName: string, - options?: DatabasesDeleteOptionalParams, - ): Promise; - /** - * Gets information about an existing database. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param databaseName Name of the database (case-sensitive). Exact database names can be retrieved by - * getting the list of all existing databases in a server. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - databaseName: string, - options?: DatabasesGetOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/firewallRules.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/firewallRules.ts deleted file mode 100644 index 18e51452e5db..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/firewallRules.ts +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - FirewallRule, - FirewallRulesListByServerOptionalParams, - FirewallRulesCreateOrUpdateOptionalParams, - FirewallRulesCreateOrUpdateResponse, - FirewallRulesDeleteOptionalParams, - FirewallRulesDeleteResponse, - FirewallRulesGetOptionalParams, - FirewallRulesGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a FirewallRules. */ -export interface FirewallRules { - /** - * Lists information about all firewall rules in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: FirewallRulesListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Creates a new firewall rule or updates an existing firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param parameters Parameters required for creating or updating a firewall rule. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - parameters: FirewallRule, - options?: FirewallRulesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - FirewallRulesCreateOrUpdateResponse - > - >; - /** - * Creates a new firewall rule or updates an existing firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param parameters Parameters required for creating or updating a firewall rule. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - parameters: FirewallRule, - options?: FirewallRulesCreateOrUpdateOptionalParams, - ): Promise; - /** - * Deletes an existing firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - options?: FirewallRulesDeleteOptionalParams, - ): Promise< - SimplePollerLike, FirewallRulesDeleteResponse> - >; - /** - * Deletes an existing firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - options?: FirewallRulesDeleteOptionalParams, - ): Promise; - /** - * Gets information about a firewall rule in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param firewallRuleName Name of the firewall rule. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - firewallRuleName: string, - options?: FirewallRulesGetOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/index.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/index.ts deleted file mode 100644 index de4b64db15f7..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -export * from "./administratorsMicrosoftEntra.js"; -export * from "./advancedThreatProtectionSettings.js"; -export * from "./serverThreatProtectionSettings.js"; -export * from "./backupsAutomaticAndOnDemand.js"; -export * from "./capabilitiesByLocation.js"; -export * from "./capabilitiesByServer.js"; -export * from "./capturedLogs.js"; -export * from "./configurations.js"; -export * from "./databases.js"; -export * from "./firewallRules.js"; -export * from "./backupsLongTermRetention.js"; -export * from "./migrations.js"; -export * from "./nameAvailability.js"; -export * from "./operations.js"; -export * from "./privateDnsZoneSuffix.js"; -export * from "./privateEndpointConnections.js"; -export * from "./privateLinkResources.js"; -export * from "./quotaUsages.js"; -export * from "./replicas.js"; -export * from "./servers.js"; -export * from "./tuningOptionsOperations.js"; -export * from "./virtualEndpoints.js"; -export * from "./virtualNetworkSubnetUsage.js"; diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/migrations.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/migrations.ts deleted file mode 100644 index d48ec6e17f5d..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/migrations.ts +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { - Migration, - MigrationsListByTargetServerOptionalParams, - MigrationsCreateOptionalParams, - MigrationsCreateResponse, - MigrationsGetOptionalParams, - MigrationsGetResponse, - MigrationResourceForPatch, - MigrationsUpdateOptionalParams, - MigrationsUpdateResponse, - MigrationsCancelOptionalParams, - MigrationsCancelResponse, - MigrationNameAvailability, - MigrationsCheckNameAvailabilityOptionalParams, - MigrationsCheckNameAvailabilityResponse, -} from "../models/index.js"; - -/// -/** Interface representing a Migrations. */ -export interface Migrations { - /** - * Lists all migrations of a target flexible server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByTargetServer( - resourceGroupName: string, - serverName: string, - options?: MigrationsListByTargetServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Creates a new migration. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param migrationName Name of migration. - * @param parameters Parameters required for creating a migration. - * @param options The options parameters. - */ - create( - resourceGroupName: string, - serverName: string, - migrationName: string, - parameters: Migration, - options?: MigrationsCreateOptionalParams, - ): Promise; - /** - * Gets information about a migration. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param migrationName Name of migration. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - migrationName: string, - options?: MigrationsGetOptionalParams, - ): Promise; - /** - * Updates an existing migration. The request body can contain one to many of the mutable properties - * present in the migration definition. Certain property updates initiate migration state transitions. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param migrationName Name of migration. - * @param parameters Parameters required to update an existing migration. - * @param options The options parameters. - */ - update( - resourceGroupName: string, - serverName: string, - migrationName: string, - parameters: MigrationResourceForPatch, - options?: MigrationsUpdateOptionalParams, - ): Promise; - /** - * Cancels an active migration. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param migrationName Name of migration. - * @param options The options parameters. - */ - cancel( - resourceGroupName: string, - serverName: string, - migrationName: string, - options?: MigrationsCancelOptionalParams, - ): Promise; - /** - * Checks if a proposed migration name is valid and available. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to check if a migration name is valid and available. - * @param options The options parameters. - */ - checkNameAvailability( - resourceGroupName: string, - serverName: string, - parameters: MigrationNameAvailability, - options?: MigrationsCheckNameAvailabilityOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/nameAvailability.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/nameAvailability.ts deleted file mode 100644 index bb1439869566..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/nameAvailability.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { - CheckNameAvailabilityRequest, - NameAvailabilityCheckGloballyOptionalParams, - NameAvailabilityCheckGloballyResponse, - NameAvailabilityCheckWithLocationOptionalParams, - NameAvailabilityCheckWithLocationResponse, -} from "../models/index.js"; - -/** Interface representing a NameAvailability. */ -export interface NameAvailability { - /** - * Checks the validity and availability of the given name, to assign it to a new server or to use it as - * the base name of a new pair of virtual endpoints. - * @param parameters Parameters required to check if a given name is valid and available to assign it - * to a new server or to use it as the base name of a new pair of virtual endpoints. - * @param options The options parameters. - */ - checkGlobally( - parameters: CheckNameAvailabilityRequest, - options?: NameAvailabilityCheckGloballyOptionalParams, - ): Promise; - /** - * Check the availability of name for resource - * @param locationName The name of the location. - * @param parameters Parameters required to check if a given name is valid and available to assign it - * to a new server or to use it as the base name of a new pair of virtual endpoints. - * @param options The options parameters. - */ - checkWithLocation( - locationName: string, - parameters: CheckNameAvailabilityRequest, - options?: NameAvailabilityCheckWithLocationOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/operations.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/operations.ts deleted file mode 100644 index ea7db2733490..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { Operation, OperationsListOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * Lists all available REST API operations. - * @param options The options parameters. - */ - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/privateDnsZoneSuffix.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/privateDnsZoneSuffix.ts deleted file mode 100644 index 86fc55ad30b3..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/privateDnsZoneSuffix.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { - PrivateDnsZoneSuffixGetOptionalParams, - PrivateDnsZoneSuffixGetResponse, -} from "../models/index.js"; - -/** Interface representing a PrivateDnsZoneSuffix. */ -export interface PrivateDnsZoneSuffix { - /** - * Gets the private DNS zone suffix. - * @param options The options parameters. - */ - get(options?: PrivateDnsZoneSuffixGetOptionalParams): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/privateEndpointConnections.ts deleted file mode 100644 index cbcdeff286a8..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/privateEndpointConnections.ts +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - PrivateEndpointConnection, - PrivateEndpointConnectionsListByServerOptionalParams, - PrivateEndpointConnectionsGetOptionalParams, - PrivateEndpointConnectionsGetResponse, - PrivateEndpointConnectionsUpdateOptionalParams, - PrivateEndpointConnectionsUpdateResponse, - PrivateEndpointConnectionsDeleteOptionalParams, - PrivateEndpointConnectionsDeleteResponse, -} from "../models/index.js"; - -/// -/** Interface representing a PrivateEndpointConnections. */ -export interface PrivateEndpointConnections { - /** - * Lists all private endpoint connections on a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: PrivateEndpointConnectionsListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Gets a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsGetOptionalParams, - ): Promise; - /** - * Approves or rejects a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param parameters Parameters required to update a private endpoint connection. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - parameters: PrivateEndpointConnection, - options?: PrivateEndpointConnectionsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsUpdateResponse - > - >; - /** - * Approves or rejects a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param parameters Parameters required to update a private endpoint connection. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - parameters: PrivateEndpointConnection, - options?: PrivateEndpointConnectionsUpdateOptionalParams, - ): Promise; - /** - * Deletes a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsDeleteResponse - > - >; - /** - * Deletes a private endpoint connection. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/privateLinkResources.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/privateLinkResources.ts deleted file mode 100644 index d9f2b692de24..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/privateLinkResources.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { - PrivateLinkResource, - PrivateLinkResourcesListByServerOptionalParams, - PrivateLinkResourcesGetOptionalParams, - PrivateLinkResourcesGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a PrivateLinkResources. */ -export interface PrivateLinkResources { - /** - * Gets the private link resources for PostgreSQL server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: PrivateLinkResourcesListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Gets a private link resource for PostgreSQL server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param groupName The name of the private link resource. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - groupName: string, - options?: PrivateLinkResourcesGetOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/quotaUsages.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/quotaUsages.ts deleted file mode 100644 index f2c810f2f113..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/quotaUsages.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { QuotaUsage, QuotaUsagesListOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a QuotaUsages. */ -export interface QuotaUsages { - /** - * Get quota usages at specified location in a given subscription. - * @param locationName The name of the location. - * @param options The options parameters. - */ - list( - locationName: string, - options?: QuotaUsagesListOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/replicas.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/replicas.ts deleted file mode 100644 index b82857e4489c..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/replicas.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { Server, ReplicasListByServerOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a Replicas. */ -export interface Replicas { - /** - * Lists all read replicas of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: ReplicasListByServerOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/serverThreatProtectionSettings.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/serverThreatProtectionSettings.ts deleted file mode 100644 index 26c93dec160c..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/serverThreatProtectionSettings.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - ThreatProtectionName, - AdvancedThreatProtectionSettingsModel, - ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, - ServerThreatProtectionSettingsCreateOrUpdateResponse, -} from "../models/index.js"; - -/** Interface representing a ServerThreatProtectionSettings. */ -export interface ServerThreatProtectionSettings { - /** - * Creates or updates a server's Advanced Threat Protection settings. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param threatProtectionName Name of the advanced threat protection settings. - * @param parameters The Advanced Threat Protection state for the server. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - serverName: string, - threatProtectionName: ThreatProtectionName, - parameters: AdvancedThreatProtectionSettingsModel, - options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ServerThreatProtectionSettingsCreateOrUpdateResponse - > - >; - /** - * Creates or updates a server's Advanced Threat Protection settings. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param threatProtectionName Name of the advanced threat protection settings. - * @param parameters The Advanced Threat Protection state for the server. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - serverName: string, - threatProtectionName: ThreatProtectionName, - parameters: AdvancedThreatProtectionSettingsModel, - options?: ServerThreatProtectionSettingsCreateOrUpdateOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/servers.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/servers.ts deleted file mode 100644 index d7b7ee9b20f0..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/servers.ts +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - Server, - ServersListByResourceGroupOptionalParams, - ServersListBySubscriptionOptionalParams, - ServersCreateOrUpdateOptionalParams, - ServersCreateOrUpdateResponse, - ServerForPatch, - ServersUpdateOptionalParams, - ServersUpdateResponse, - ServersDeleteOptionalParams, - ServersDeleteResponse, - ServersGetOptionalParams, - ServersGetResponse, - ServersRestartOptionalParams, - ServersRestartResponse, - ServersStartOptionalParams, - ServersStartResponse, - ServersStopOptionalParams, - ServersStopResponse, -} from "../models/index.js"; - -/// -/** Interface representing a Servers. */ -export interface Servers { - /** - * Lists all servers in a resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - listByResourceGroup( - resourceGroupName: string, - options?: ServersListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Lists all servers in a subscription. - * @param options The options parameters. - */ - listBySubscription( - options?: ServersListBySubscriptionOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Creates a new server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to create a new server or to update an existing server. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - serverName: string, - parameters: Server, - options?: ServersCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike, ServersCreateOrUpdateResponse> - >; - /** - * Creates a new server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to create a new server or to update an existing server. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - serverName: string, - parameters: Server, - options?: ServersCreateOrUpdateOptionalParams, - ): Promise; - /** - * Updates an existing server. The request body can contain one or multiple of the properties present - * in the normal server definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to update a server. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - serverName: string, - parameters: ServerForPatch, - options?: ServersUpdateOptionalParams, - ): Promise, ServersUpdateResponse>>; - /** - * Updates an existing server. The request body can contain one or multiple of the properties present - * in the normal server definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters Parameters required to update a server. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - serverName: string, - parameters: ServerForPatch, - options?: ServersUpdateOptionalParams, - ): Promise; - /** - * Deletes or drops an existing server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - serverName: string, - options?: ServersDeleteOptionalParams, - ): Promise, ServersDeleteResponse>>; - /** - * Deletes or drops an existing server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - options?: ServersDeleteOptionalParams, - ): Promise; - /** - * Gets information about an existing server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - options?: ServersGetOptionalParams, - ): Promise; - /** - * Restarts PostgreSQL database engine in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - beginRestart( - resourceGroupName: string, - serverName: string, - options?: ServersRestartOptionalParams, - ): Promise, ServersRestartResponse>>; - /** - * Restarts PostgreSQL database engine in a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - beginRestartAndWait( - resourceGroupName: string, - serverName: string, - options?: ServersRestartOptionalParams, - ): Promise; - /** - * Starts a stopped server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - beginStart( - resourceGroupName: string, - serverName: string, - options?: ServersStartOptionalParams, - ): Promise, ServersStartResponse>>; - /** - * Starts a stopped server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - beginStartAndWait( - resourceGroupName: string, - serverName: string, - options?: ServersStartOptionalParams, - ): Promise; - /** - * Stops a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - beginStop( - resourceGroupName: string, - serverName: string, - options?: ServersStopOptionalParams, - ): Promise, ServersStopResponse>>; - /** - * Stops a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - beginStopAndWait( - resourceGroupName: string, - serverName: string, - options?: ServersStopOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/tuningOptionsOperations.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/tuningOptionsOperations.ts deleted file mode 100644 index b715300f601d..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/tuningOptionsOperations.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { - ObjectRecommendation, - TuningOptionParameterEnum, - TuningOptionsListRecommendationsOptionalParams, - TuningOptions, - TuningOptionsListByServerOptionalParams, - TuningOptionsGetOptionalParams, - TuningOptionsGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a TuningOptionsOperations. */ -export interface TuningOptionsOperations { - /** - * Lists available object recommendations. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param tuningOption The name of the tuning option. - * @param options The options parameters. - */ - listRecommendations( - resourceGroupName: string, - serverName: string, - tuningOption: TuningOptionParameterEnum, - options?: TuningOptionsListRecommendationsOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Lists the tuning options of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: TuningOptionsListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Gets the tuning options of a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param tuningOption The name of the tuning option. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - tuningOption: TuningOptionParameterEnum, - options?: TuningOptionsGetOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/virtualEndpoints.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/virtualEndpoints.ts deleted file mode 100644 index cb191aa21d17..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/virtualEndpoints.ts +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { PagedAsyncIterableIterator } from "@azure/core-paging"; -import type { SimplePollerLike, OperationState } from "@azure/core-lro"; -import type { - VirtualEndpoint, - VirtualEndpointsListByServerOptionalParams, - VirtualEndpointsCreateOptionalParams, - VirtualEndpointsCreateResponse, - VirtualEndpointResourceForPatch, - VirtualEndpointsUpdateOptionalParams, - VirtualEndpointsUpdateResponse, - VirtualEndpointsDeleteOptionalParams, - VirtualEndpointsDeleteResponse, - VirtualEndpointsGetOptionalParams, - VirtualEndpointsGetResponse, -} from "../models/index.js"; - -/// -/** Interface representing a VirtualEndpoints. */ -export interface VirtualEndpoints { - /** - * Lists pair of virtual endpoints associated to a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param options The options parameters. - */ - listByServer( - resourceGroupName: string, - serverName: string, - options?: VirtualEndpointsListByServerOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Creates a pair of virtual endpoints for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param parameters Parameters required to create or update a pair of virtual endpoints. - * @param options The options parameters. - */ - beginCreate( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - parameters: VirtualEndpoint, - options?: VirtualEndpointsCreateOptionalParams, - ): Promise< - SimplePollerLike, VirtualEndpointsCreateResponse> - >; - /** - * Creates a pair of virtual endpoints for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param parameters Parameters required to create or update a pair of virtual endpoints. - * @param options The options parameters. - */ - beginCreateAndWait( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - parameters: VirtualEndpoint, - options?: VirtualEndpointsCreateOptionalParams, - ): Promise; - /** - * Updates a pair of virtual endpoints for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param parameters Parameters required to update a pair of virtual endpoints. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - parameters: VirtualEndpointResourceForPatch, - options?: VirtualEndpointsUpdateOptionalParams, - ): Promise< - SimplePollerLike, VirtualEndpointsUpdateResponse> - >; - /** - * Updates a pair of virtual endpoints for a server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param parameters Parameters required to update a pair of virtual endpoints. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - parameters: VirtualEndpointResourceForPatch, - options?: VirtualEndpointsUpdateOptionalParams, - ): Promise; - /** - * Deletes a pair of virtual endpoints. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - options?: VirtualEndpointsDeleteOptionalParams, - ): Promise< - SimplePollerLike, VirtualEndpointsDeleteResponse> - >; - /** - * Deletes a pair of virtual endpoints. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - options?: VirtualEndpointsDeleteOptionalParams, - ): Promise; - /** - * Gets information about a pair of virtual endpoints. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param virtualEndpointName Base name of the virtual endpoints. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - serverName: string, - virtualEndpointName: string, - options?: VirtualEndpointsGetOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/virtualNetworkSubnetUsage.ts b/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/virtualNetworkSubnetUsage.ts deleted file mode 100644 index 385f651ecef2..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/operationsInterfaces/virtualNetworkSubnetUsage.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import type { - VirtualNetworkSubnetUsageParameter, - VirtualNetworkSubnetUsageListOptionalParams, - VirtualNetworkSubnetUsageListResponse, -} from "../models/index.js"; - -/** Interface representing a VirtualNetworkSubnetUsage. */ -export interface VirtualNetworkSubnetUsage { - /** - * Lists the virtual network subnet usage for a given virtual network. - * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. - * @param options The options parameters. - */ - list( - locationName: string, - parameters: VirtualNetworkSubnetUsageParameter, - options?: VirtualNetworkSubnetUsageListOptionalParams, - ): Promise; -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/pagingHelper.ts b/sdk/postgresql/arm-postgresql-flexible/src/pagingHelper.ts deleted file mode 100644 index f64c4c8390ed..000000000000 --- a/sdk/postgresql/arm-postgresql-flexible/src/pagingHelper.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken(page: unknown, continuationToken: string | undefined): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/postgreSQLManagementFlexibleServerClient.ts b/sdk/postgresql/arm-postgresql-flexible/src/postgreSQLManagementFlexibleServerClient.ts index b8d8f5bce596..e2f83ccbc24e 100644 --- a/sdk/postgresql/arm-postgresql-flexible/src/postgreSQLManagementFlexibleServerClient.ts +++ b/sdk/postgresql/arm-postgresql-flexible/src/postgreSQLManagementFlexibleServerClient.ts @@ -1,94 +1,82 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; -import type { PipelineRequest, PipelineResponse, SendRequest } from "@azure/core-rest-pipeline"; -import type * as coreAuth from "@azure/core-auth"; -import { - AdministratorsMicrosoftEntraImpl, - AdvancedThreatProtectionSettingsImpl, - ServerThreatProtectionSettingsImpl, - BackupsAutomaticAndOnDemandImpl, - CapabilitiesByLocationImpl, - CapabilitiesByServerImpl, - CapturedLogsImpl, - ConfigurationsImpl, - DatabasesImpl, - FirewallRulesImpl, - BackupsLongTermRetentionImpl, - MigrationsImpl, - NameAvailabilityImpl, - OperationsImpl, - PrivateDnsZoneSuffixImpl, - PrivateEndpointConnectionsImpl, - PrivateLinkResourcesImpl, - QuotaUsagesImpl, - ReplicasImpl, - ServersImpl, - TuningOptionsOperationsImpl, - VirtualEndpointsImpl, - VirtualNetworkSubnetUsageImpl, -} from "./operations/index.js"; import type { - AdministratorsMicrosoftEntra, - AdvancedThreatProtectionSettings, - ServerThreatProtectionSettings, - BackupsAutomaticAndOnDemand, - CapabilitiesByLocation, - CapabilitiesByServer, - CapturedLogs, - Configurations, - Databases, - FirewallRules, - BackupsLongTermRetention, - Migrations, - NameAvailability, - Operations, - PrivateDnsZoneSuffix, - PrivateEndpointConnections, - PrivateLinkResources, - QuotaUsages, - Replicas, - Servers, - TuningOptionsOperations, - VirtualEndpoints, - VirtualNetworkSubnetUsage, -} from "./operationsInterfaces/index.js"; -import type { PostgreSQLManagementFlexibleServerClientOptionalParams } from "./models/index.js"; + PostgreSQLManagementFlexibleServerContext, + PostgreSQLManagementFlexibleServerClientOptionalParams, +} from "./api/index.js"; +import { createPostgreSQLManagementFlexibleServer } from "./api/index.js"; +import type { AdministratorsMicrosoftEntraOperations } from "./classic/administratorsMicrosoftEntra/index.js"; +import { _getAdministratorsMicrosoftEntraOperations } from "./classic/administratorsMicrosoftEntra/index.js"; +import type { AdvancedThreatProtectionSettingsOperations } from "./classic/advancedThreatProtectionSettings/index.js"; +import { _getAdvancedThreatProtectionSettingsOperations } from "./classic/advancedThreatProtectionSettings/index.js"; +import type { BackupsAutomaticAndOnDemandOperations } from "./classic/backupsAutomaticAndOnDemand/index.js"; +import { _getBackupsAutomaticAndOnDemandOperations } from "./classic/backupsAutomaticAndOnDemand/index.js"; +import type { BackupsLongTermRetentionOperations } from "./classic/backupsLongTermRetention/index.js"; +import { _getBackupsLongTermRetentionOperations } from "./classic/backupsLongTermRetention/index.js"; +import type { CapabilitiesByLocationOperations } from "./classic/capabilitiesByLocation/index.js"; +import { _getCapabilitiesByLocationOperations } from "./classic/capabilitiesByLocation/index.js"; +import type { CapabilitiesByServerOperations } from "./classic/capabilitiesByServer/index.js"; +import { _getCapabilitiesByServerOperations } from "./classic/capabilitiesByServer/index.js"; +import type { CapturedLogsOperations } from "./classic/capturedLogs/index.js"; +import { _getCapturedLogsOperations } from "./classic/capturedLogs/index.js"; +import type { ConfigurationsOperations } from "./classic/configurations/index.js"; +import { _getConfigurationsOperations } from "./classic/configurations/index.js"; +import type { DatabasesOperations } from "./classic/databases/index.js"; +import { _getDatabasesOperations } from "./classic/databases/index.js"; +import type { FirewallRulesOperations } from "./classic/firewallRules/index.js"; +import { _getFirewallRulesOperations } from "./classic/firewallRules/index.js"; +import type { MigrationsOperations } from "./classic/migrations/index.js"; +import { _getMigrationsOperations } from "./classic/migrations/index.js"; +import type { NameAvailabilityOperations } from "./classic/nameAvailability/index.js"; +import { _getNameAvailabilityOperations } from "./classic/nameAvailability/index.js"; +import type { OperationsOperations } from "./classic/operations/index.js"; +import { _getOperationsOperations } from "./classic/operations/index.js"; +import type { PrivateDnsZoneSuffixOperations } from "./classic/privateDnsZoneSuffix/index.js"; +import { _getPrivateDnsZoneSuffixOperations } from "./classic/privateDnsZoneSuffix/index.js"; +import type { PrivateEndpointConnectionsOperations } from "./classic/privateEndpointConnections/index.js"; +import { _getPrivateEndpointConnectionsOperations } from "./classic/privateEndpointConnections/index.js"; +import type { PrivateLinkResourcesOperations } from "./classic/privateLinkResources/index.js"; +import { _getPrivateLinkResourcesOperations } from "./classic/privateLinkResources/index.js"; +import type { QuotaUsagesOperations } from "./classic/quotaUsages/index.js"; +import { _getQuotaUsagesOperations } from "./classic/quotaUsages/index.js"; +import type { ReplicasOperations } from "./classic/replicas/index.js"; +import { _getReplicasOperations } from "./classic/replicas/index.js"; +import type { ServerThreatProtectionSettingsOperations } from "./classic/serverThreatProtectionSettings/index.js"; +import { _getServerThreatProtectionSettingsOperations } from "./classic/serverThreatProtectionSettings/index.js"; +import type { ServersOperations } from "./classic/servers/index.js"; +import { _getServersOperations } from "./classic/servers/index.js"; +import type { TuningOptionsOperations } from "./classic/tuningOptions/index.js"; +import { _getTuningOptionsOperations } from "./classic/tuningOptions/index.js"; +import type { VirtualEndpointsOperations } from "./classic/virtualEndpoints/index.js"; +import { _getVirtualEndpointsOperations } from "./classic/virtualEndpoints/index.js"; +import type { VirtualNetworkSubnetUsageOperations } from "./classic/virtualNetworkSubnetUsage/index.js"; +import { _getVirtualNetworkSubnetUsageOperations } from "./classic/virtualNetworkSubnetUsage/index.js"; +import type { TokenCredential } from "@azure/core-auth"; +import type { Pipeline } from "@azure/core-rest-pipeline"; + +export type { PostgreSQLManagementFlexibleServerClientOptionalParams } from "./api/postgreSQLManagementFlexibleServerContext.js"; -export class PostgreSQLManagementFlexibleServerClient extends coreClient.ServiceClient { - $host: string; - subscriptionId?: string; - apiVersion: string; +export class PostgreSQLManagementFlexibleServerClient { + private _client: PostgreSQLManagementFlexibleServerContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; - /** - * Initializes a new instance of the PostgreSQLManagementFlexibleServerClient class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param options The parameter options - */ constructor( - credentials: coreAuth.TokenCredential, - subscriptionId: string, + credential: TokenCredential, options?: PostgreSQLManagementFlexibleServerClientOptionalParams, ); constructor( - credentials: coreAuth.TokenCredential, + credential: TokenCredential, + subscriptionId: string, options?: PostgreSQLManagementFlexibleServerClientOptionalParams, ); + /** The Azure Database for PostgreSQL management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, network configuration, security alert policies, log files and configurations with new business model. */ constructor( - credentials: coreAuth.TokenCredential, - subscriptionIdOrOptions?: PostgreSQLManagementFlexibleServerClientOptionalParams | string, + credential: TokenCredential, + subscriptionIdOrOptions?: string | PostgreSQLManagementFlexibleServerClientOptionalParams, options?: PostgreSQLManagementFlexibleServerClientOptionalParams, ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } - let subscriptionId: string | undefined; if (typeof subscriptionIdOrOptions === "string") { @@ -97,138 +85,89 @@ export class PostgreSQLManagementFlexibleServerClient extends coreClient.Service options = subscriptionIdOrOptions; } - // Initializing default values for options - if (!options) { - options = {}; - } - const defaults: PostgreSQLManagementFlexibleServerClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials, - }; - - const packageDetails = `azsdk-js-arm-postgresql-flexible/9.0.0`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, + options = options ?? {}; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createPostgreSQLManagementFlexibleServer(credential, subscriptionId ?? "", { ...options, - userAgentOptions: { - userAgentPrefix, - }, - endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com", - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = - options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === coreRestPipeline.bearerTokenAuthenticationPolicyName, - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName, - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge, - }, - }), - ); - } - // Parameter assignments - this.subscriptionId = subscriptionId; - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2025-08-01"; - this.administratorsMicrosoftEntra = new AdministratorsMicrosoftEntraImpl(this); - this.advancedThreatProtectionSettings = new AdvancedThreatProtectionSettingsImpl(this); - this.serverThreatProtectionSettings = new ServerThreatProtectionSettingsImpl(this); - this.backupsAutomaticAndOnDemand = new BackupsAutomaticAndOnDemandImpl(this); - this.capabilitiesByLocation = new CapabilitiesByLocationImpl(this); - this.capabilitiesByServer = new CapabilitiesByServerImpl(this); - this.capturedLogs = new CapturedLogsImpl(this); - this.configurations = new ConfigurationsImpl(this); - this.databases = new DatabasesImpl(this); - this.firewallRules = new FirewallRulesImpl(this); - this.backupsLongTermRetention = new BackupsLongTermRetentionImpl(this); - this.migrations = new MigrationsImpl(this); - this.nameAvailability = new NameAvailabilityImpl(this); - this.operations = new OperationsImpl(this); - this.privateDnsZoneSuffix = new PrivateDnsZoneSuffixImpl(this); - this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); - this.privateLinkResources = new PrivateLinkResourcesImpl(this); - this.quotaUsages = new QuotaUsagesImpl(this); - this.replicas = new ReplicasImpl(this); - this.servers = new ServersImpl(this); - this.tuningOptionsOperations = new TuningOptionsOperationsImpl(this); - this.virtualEndpoints = new VirtualEndpointsImpl(this); - this.virtualNetworkSubnetUsage = new VirtualNetworkSubnetUsageImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest(request: PipelineRequest, next: SendRequest): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - }, - }; - this.pipeline.addPolicy(apiVersionPolicy); + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.virtualNetworkSubnetUsage = _getVirtualNetworkSubnetUsageOperations(this._client); + this.quotaUsages = _getQuotaUsagesOperations(this._client); + this.privateDnsZoneSuffix = _getPrivateDnsZoneSuffixOperations(this._client); + this.nameAvailability = _getNameAvailabilityOperations(this._client); + this.capabilitiesByLocation = _getCapabilitiesByLocationOperations(this._client); + this.tuningOptions = _getTuningOptionsOperations(this._client); + this.backupsAutomaticAndOnDemand = _getBackupsAutomaticAndOnDemandOperations(this._client); + this.serverThreatProtectionSettings = _getServerThreatProtectionSettingsOperations( + this._client, + ); + this.advancedThreatProtectionSettings = _getAdvancedThreatProtectionSettingsOperations( + this._client, + ); + this.replicas = _getReplicasOperations(this._client); + this.backupsLongTermRetention = _getBackupsLongTermRetentionOperations(this._client); + this.capturedLogs = _getCapturedLogsOperations(this._client); + this.capabilitiesByServer = _getCapabilitiesByServerOperations(this._client); + this.administratorsMicrosoftEntra = _getAdministratorsMicrosoftEntraOperations(this._client); + this.virtualEndpoints = _getVirtualEndpointsOperations(this._client); + this.privateLinkResources = _getPrivateLinkResourcesOperations(this._client); + this.privateEndpointConnections = _getPrivateEndpointConnectionsOperations(this._client); + this.firewallRules = _getFirewallRulesOperations(this._client); + this.databases = _getDatabasesOperations(this._client); + this.configurations = _getConfigurationsOperations(this._client); + this.servers = _getServersOperations(this._client); + this.migrations = _getMigrationsOperations(this._client); + this.operations = _getOperationsOperations(this._client); } - administratorsMicrosoftEntra: AdministratorsMicrosoftEntra; - advancedThreatProtectionSettings: AdvancedThreatProtectionSettings; - serverThreatProtectionSettings: ServerThreatProtectionSettings; - backupsAutomaticAndOnDemand: BackupsAutomaticAndOnDemand; - capabilitiesByLocation: CapabilitiesByLocation; - capabilitiesByServer: CapabilitiesByServer; - capturedLogs: CapturedLogs; - configurations: Configurations; - databases: Databases; - firewallRules: FirewallRules; - backupsLongTermRetention: BackupsLongTermRetention; - migrations: Migrations; - nameAvailability: NameAvailability; - operations: Operations; - privateDnsZoneSuffix: PrivateDnsZoneSuffix; - privateEndpointConnections: PrivateEndpointConnections; - privateLinkResources: PrivateLinkResources; - quotaUsages: QuotaUsages; - replicas: Replicas; - servers: Servers; - tuningOptionsOperations: TuningOptionsOperations; - virtualEndpoints: VirtualEndpoints; - virtualNetworkSubnetUsage: VirtualNetworkSubnetUsage; + /** The operation groups for virtualNetworkSubnetUsage */ + public readonly virtualNetworkSubnetUsage: VirtualNetworkSubnetUsageOperations; + /** The operation groups for quotaUsages */ + public readonly quotaUsages: QuotaUsagesOperations; + /** The operation groups for privateDnsZoneSuffix */ + public readonly privateDnsZoneSuffix: PrivateDnsZoneSuffixOperations; + /** The operation groups for nameAvailability */ + public readonly nameAvailability: NameAvailabilityOperations; + /** The operation groups for capabilitiesByLocation */ + public readonly capabilitiesByLocation: CapabilitiesByLocationOperations; + /** The operation groups for tuningOptions */ + public readonly tuningOptions: TuningOptionsOperations; + /** The operation groups for backupsAutomaticAndOnDemand */ + public readonly backupsAutomaticAndOnDemand: BackupsAutomaticAndOnDemandOperations; + /** The operation groups for serverThreatProtectionSettings */ + public readonly serverThreatProtectionSettings: ServerThreatProtectionSettingsOperations; + /** The operation groups for advancedThreatProtectionSettings */ + public readonly advancedThreatProtectionSettings: AdvancedThreatProtectionSettingsOperations; + /** The operation groups for replicas */ + public readonly replicas: ReplicasOperations; + /** The operation groups for backupsLongTermRetention */ + public readonly backupsLongTermRetention: BackupsLongTermRetentionOperations; + /** The operation groups for capturedLogs */ + public readonly capturedLogs: CapturedLogsOperations; + /** The operation groups for capabilitiesByServer */ + public readonly capabilitiesByServer: CapabilitiesByServerOperations; + /** The operation groups for administratorsMicrosoftEntra */ + public readonly administratorsMicrosoftEntra: AdministratorsMicrosoftEntraOperations; + /** The operation groups for virtualEndpoints */ + public readonly virtualEndpoints: VirtualEndpointsOperations; + /** The operation groups for privateLinkResources */ + public readonly privateLinkResources: PrivateLinkResourcesOperations; + /** The operation groups for privateEndpointConnections */ + public readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + /** The operation groups for firewallRules */ + public readonly firewallRules: FirewallRulesOperations; + /** The operation groups for databases */ + public readonly databases: DatabasesOperations; + /** The operation groups for configurations */ + public readonly configurations: ConfigurationsOperations; + /** The operation groups for servers */ + public readonly servers: ServersOperations; + /** The operation groups for migrations */ + public readonly migrations: MigrationsOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; } diff --git a/sdk/postgresql/arm-postgresql-flexible/src/restorePollerHelpers.ts b/sdk/postgresql/arm-postgresql-flexible/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..c06c0993de74 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/restorePollerHelpers.ts @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PostgreSQLManagementFlexibleServerClient } from "./postgreSQLManagementFlexibleServerClient.js"; +import { + _$deleteDeserialize, + _createDeserialize, +} from "./api/backupsAutomaticAndOnDemand/operations.js"; +import { _createOrUpdateDeserialize } from "./api/serverThreatProtectionSettings/operations.js"; +import { _startDeserialize } from "./api/backupsLongTermRetention/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeAdministratorsMicrosoftEntra, + _createOrUpdateDeserialize as _createOrUpdateDeserializeAdministratorsMicrosoftEntra, +} from "./api/administratorsMicrosoftEntra/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeVirtualEndpoints, + _updateDeserialize, + _createDeserialize as _createDeserializeVirtualEndpoints, +} from "./api/virtualEndpoints/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializePrivateEndpointConnections, + _updateDeserialize as _updateDeserializePrivateEndpointConnections, +} from "./api/privateEndpointConnections/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeFirewallRules, + _createOrUpdateDeserialize as _createOrUpdateDeserializeFirewallRules, +} from "./api/firewallRules/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeDatabases, + _createDeserialize as _createDeserializeDatabases, +} from "./api/databases/operations.js"; +import { + _updateDeserialize as _updateDeserializeConfigurations, + _putDeserialize, +} from "./api/configurations/operations.js"; +import { + _migrateNetworkModeDeserialize, + _stopDeserialize, + _startDeserialize as _startDeserializeServers, + _restartDeserialize, + _$deleteDeserialize as _$deleteDeserializeServers, + _updateDeserialize as _updateDeserializeServers, + _createOrUpdateDeserialize as _createOrUpdateDeserializeServers, +} from "./api/servers/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import type { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { PollerLike, OperationState, ResourceLocationConfig } from "@azure/core-lro"; +import { deserializeState } from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: PostgreSQLManagementFlexibleServerClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + const apiVersion = getApiVersionFromUrl(initialRequestUrl); + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + apiVersion, + }, + ); +} + +interface DeserializationHelper { + deserializer: (result: PathUncheckedResponse) => Promise; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}": + { deserializer: _$deleteDeserialize, expectedStatuses: ["202", "204", "200"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}": + { deserializer: _createDeserialize, expectedStatuses: ["202", "200", "201"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}": + { deserializer: _createOrUpdateDeserialize, expectedStatuses: ["202", "200", "201"] }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/startLtrBackup": + { deserializer: _startDeserialize, expectedStatuses: ["200", "202", "201"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}": + { + deserializer: _$deleteDeserializeAdministratorsMicrosoftEntra, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}": + { + deserializer: _createOrUpdateDeserializeAdministratorsMicrosoftEntra, + expectedStatuses: ["202", "200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}": + { deserializer: _$deleteDeserializeVirtualEndpoints, expectedStatuses: ["202", "204", "200"] }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}": + { deserializer: _updateDeserialize, expectedStatuses: ["202", "200", "201"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}": + { deserializer: _createDeserializeVirtualEndpoints, expectedStatuses: ["202", "200", "201"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}": + { + deserializer: _$deleteDeserializePrivateEndpointConnections, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}": + { + deserializer: _updateDeserializePrivateEndpointConnections, + expectedStatuses: ["202", "200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}": + { deserializer: _$deleteDeserializeFirewallRules, expectedStatuses: ["202", "204", "200"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}": + { + deserializer: _createOrUpdateDeserializeFirewallRules, + expectedStatuses: ["202", "200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}": + { deserializer: _$deleteDeserializeDatabases, expectedStatuses: ["202", "204", "200"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}": + { deserializer: _createDeserializeDatabases, expectedStatuses: ["202", "200", "201"] }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}": + { deserializer: _updateDeserializeConfigurations, expectedStatuses: ["202", "200", "201"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}": + { deserializer: _putDeserialize, expectedStatuses: ["202", "200", "201"] }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrateNetwork": + { deserializer: _migrateNetworkModeDeserialize, expectedStatuses: ["200", "202", "201"] }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop": + { deserializer: _stopDeserialize, expectedStatuses: ["202", "200", "201"] }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start": + { deserializer: _startDeserializeServers, expectedStatuses: ["202", "200", "201"] }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart": + { deserializer: _restartDeserialize, expectedStatuses: ["202", "200", "201"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}": + { deserializer: _$deleteDeserializeServers, expectedStatuses: ["202", "204", "200"] }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}": + { deserializer: _updateDeserializeServers, expectedStatuses: ["202", "200", "201"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}": + { deserializer: _createOrUpdateDeserializeServers, expectedStatuses: ["202", "200", "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); +} + +function getApiVersionFromUrl(urlStr: string): string | undefined { + const url = new URL(urlStr); + return url.searchParams.get("api-version") ?? undefined; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/cloudSettingHelpers.ts b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 000000000000..613112c6e397 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * An enum to describe Azure Cloud environments. + * @enum {string} + */ +export enum AzureClouds { + /** Azure public cloud, which is the default cloud for Azure SDKs. */ + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + /** Azure China cloud */ + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + /** Azure US government cloud */ + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT", +} + +/** The supported values for cloud setting as a string literal type */ +export type AzureSupportedClouds = `${AzureClouds}`; + +/** + * Gets the Azure Resource Manager endpoint URL for the specified cloud setting. + * @param cloudSetting - The Azure cloud environment setting. Use one of the AzureClouds enum values. + * @returns The ARM endpoint URL for the specified cloud, or undefined if cloudSetting is undefined. + * @throws {Error} Throws an error if an unknown cloud setting is provided. + */ +export function getArmEndpoint(cloudSetting?: AzureSupportedClouds): string | undefined { + if (cloudSetting === undefined) { + return undefined; + } + const cloudEndpoints: Record = { + AZURE_CHINA_CLOUD: "https://management.chinacloudapi.cn/", + AZURE_US_GOVERNMENT: "https://management.usgovcloudapi.net/", + AZURE_PUBLIC_CLOUD: "https://management.azure.com/", + }; + if (cloudSetting in cloudEndpoints) { + return cloudEndpoints[cloudSetting]; + } else { + throw new Error( + `Unknown cloud setting: ${cloudSetting}. Please refer to the enum AzureClouds for possible values.`, + ); + } +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/pagingHelpers.ts b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..9258ba95eda8 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; + nextLinkMethod?: "GET" | "POST"; + apiVersion?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const nextLinkMethod = options.nextLinkMethod ?? "GET"; + const apiVersion = options.apiVersion; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + let result; + if (pageLink === undefined) { + result = await getInitialResponse(); + } else { + const resolvedPageLink = apiVersion ? addApiVersionToUrl(pageLink, apiVersion) : pageLink; + result = + nextLinkMethod === "POST" + ? await client.pathUnchecked(resolvedPageLink).post() + : await client.pathUnchecked(resolvedPageLink).get(); + } + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${ + Array.from(urlObj.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/pollingHelpers.ts b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..8e36a866edcc --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + OperationResponse, +} from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; + /** + * The api-version of the LRO + */ + apiVersion?: string; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse, apiVersion } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + const pollingPath = apiVersion ? addApiVersionToUrl(path, apiVersion) : path; + response = await client.pathUnchecked(pollingPath).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${ + Array.from(urlObj.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/serialization/check-prop-undefined.ts b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/serialization/check-prop-undefined.ts new file mode 100644 index 000000000000..50f78829e491 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/serialization/check-prop-undefined.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * Returns true if all specified properties of the item are undefined. + * @param item The object to check. + * @param properties The list of property names to check on the item. + * @returns True if all specified properties are undefined, otherwise false. + */ +export function areAllPropsUndefined(item: Record, properties: string[]): boolean { + for (const property of properties) { + if (item[property] !== undefined) { + return false; + } + } + return true; +} diff --git a/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/simplePollerHelpers.ts b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/simplePollerHelpers.ts new file mode 100644 index 000000000000..f6996f3cee67 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/simplePollerHelpers.ts @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { PollerLike, OperationState, CancelOnProgress } from "@azure/core-lro"; +import type { AbortSignalLike } from "@azure/abort-controller"; + +/** + * A simple poller that can be used to poll a long running operation. + */ +export interface SimplePollerLike, 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/postgresql/arm-postgresql-flexible/src/static-helpers/urlTemplate.ts b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..e8af8cd3ab73 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/src/static-helpers/urlTemplate.ts @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// --------------------- +// interfaces +// --------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string): string { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string): string { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string): string { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any): boolean { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false): string { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions): string { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + if (named && val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions): string | undefined { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + const result = template.replace(/\{([^{}]+)\}|([^{}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + op = expr[0]; + expr = expr.slice(1); + } + const varList = expr.split(/,/g); + const innerResult = []; + for (const varSpec of varList) { + const varMatch = /([^:*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: innerResult.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + innerResult.push(varValue); + } + } + return innerResult.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/postgresql/arm-postgresql-flexible/test/postgresql_flexible_operations_test.spec.ts b/sdk/postgresql/arm-postgresql-flexible/test/postgresql_flexible_operations_test.spec.ts index ca198f655df2..7e67c9d82edf 100644 --- a/sdk/postgresql/arm-postgresql-flexible/test/postgresql_flexible_operations_test.spec.ts +++ b/sdk/postgresql/arm-postgresql-flexible/test/postgresql_flexible_operations_test.spec.ts @@ -28,7 +28,7 @@ export const testPollingOptions = { updateIntervalInMs: isPlaybackMode() ? 0 : undefined, }; -describe("PostgreSQLFlexible test", () => { +describe.skip("PostgreSQLFlexible test", () => { let recorder: Recorder; let subscriptionId: string; let client: PostgreSQLManagementFlexibleServerClient; diff --git a/sdk/postgresql/arm-postgresql-flexible/test/snippets.spec.ts b/sdk/postgresql/arm-postgresql-flexible/test/snippets.spec.ts index 0cd9038d7369..c4d619d602d8 100644 --- a/sdk/postgresql/arm-postgresql-flexible/test/snippets.spec.ts +++ b/sdk/postgresql/arm-postgresql-flexible/test/snippets.spec.ts @@ -16,11 +16,11 @@ describe("snippets", () => { }); it("ReadmeSampleCreateClient_Browser", async () => { - const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "", }); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId); }); diff --git a/sdk/postgresql/arm-postgresql-flexible/tsp-location.yaml b/sdk/postgresql/arm-postgresql-flexible/tsp-location.yaml new file mode 100644 index 000000000000..a79a5ed731f6 --- /dev/null +++ b/sdk/postgresql/arm-postgresql-flexible/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/postgresql/DBforPostgreSQL.Management +commit: 56b4c685b89a096de3d97b3b86efcbf99c470138 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/postgresql/arm-postgresql-flexible/warp.config.yml b/sdk/postgresql/arm-postgresql-flexible/warp.config.yml index f90f8c2646b0..9bcc310c8039 100644 --- a/sdk/postgresql/arm-postgresql-flexible/warp.config.yml +++ b/sdk/postgresql/arm-postgresql-flexible/warp.config.yml @@ -1,15 +1,47 @@ +# warp.config.yml — build configuration + exports: "./package.json": "./package.json" ".": "./src/index.ts" + "./api": "./src/api/index.ts" + "./api/virtualNetworkSubnetUsage": "src/api/virtualNetworkSubnetUsage/index.ts" + "./api/quotaUsages": "src/api/quotaUsages/index.ts" + "./api/privateDnsZoneSuffix": "src/api/privateDnsZoneSuffix/index.ts" + "./api/nameAvailability": "src/api/nameAvailability/index.ts" + "./api/capabilitiesByLocation": "src/api/capabilitiesByLocation/index.ts" + "./api/tuningOptions": "src/api/tuningOptions/index.ts" + "./api/backupsAutomaticAndOnDemand": "src/api/backupsAutomaticAndOnDemand/index.ts" + "./api/serverThreatProtectionSettings": "src/api/serverThreatProtectionSettings/index.ts" + "./api/advancedThreatProtectionSettings": "src/api/advancedThreatProtectionSettings/index.ts" + "./api/replicas": "src/api/replicas/index.ts" + "./api/backupsLongTermRetention": "src/api/backupsLongTermRetention/index.ts" + "./api/capturedLogs": "src/api/capturedLogs/index.ts" + "./api/capabilitiesByServer": "src/api/capabilitiesByServer/index.ts" + "./api/administratorsMicrosoftEntra": "src/api/administratorsMicrosoftEntra/index.ts" + "./api/virtualEndpoints": "src/api/virtualEndpoints/index.ts" + "./api/privateLinkResources": "src/api/privateLinkResources/index.ts" + "./api/privateEndpointConnections": "src/api/privateEndpointConnections/index.ts" + "./api/firewallRules": "src/api/firewallRules/index.ts" + "./api/databases": "src/api/databases/index.ts" + "./api/configurations": "src/api/configurations/index.ts" + "./api/servers": "src/api/servers/index.ts" + "./api/migrations": "src/api/migrations/index.ts" + "./api/operations": "src/api/operations/index.ts" + "./models": "./src/models/index.ts" targets: - name: browser tsconfig: "../../../tsconfig.src.browser.json" + polyfillSuffix: "-browser" + - name: react-native tsconfig: "../../../tsconfig.src.react-native.json" + polyfillSuffix: "-react-native" + - name: esm condition: import tsconfig: "../../../tsconfig.src.esm.json" + - name: commonjs condition: require tsconfig: "../../../tsconfig.src.cjs.json" diff --git a/sdk/postgresql/ci.mgmt.yml b/sdk/postgresql/ci.mgmt.yml index 9870d16ee9bc..9a7875fd4ea6 100644 --- a/sdk/postgresql/ci.mgmt.yml +++ b/sdk/postgresql/ci.mgmt.yml @@ -1,11 +1,13 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: - main - release/* - hotfix/* + exclude: + - feature/v4 paths: include: - sdk/postgresql/ci.mgmt.yml